Spring Validator Interface compare with a given value

0

I have a class Savings that contains the info input by the user in a form:

public class Savings{

    private int numberOfTimes;
    private double value;

...
}

and a controller that calls the validator () method from the Spring Validator Interface for the validation of those inputs:

public class blablablaController {
    @Autowired
    private int todaysMaxValue;

    @PostMapping(path = { "/blablabla" })
    public String submit(@ModelAttribute("savings") Savings savings, BindingResult result, ModelMap model) {

            SavingsValidator sv= new SavingsValidator ();
            sv.validate(savings, result);
    }
}

The issue is that I need to make sure that the value of the user inputs does not exceed the certain ammound, "todaysMaxValue", that is external to the Class SavingsValidator

    
asked by anonymous 15.01.2018 / 19:25

0 answers