Check that read-only fields have not been modified

2

I am using spring-mvc and I have a form in a jsp, in this form there are fields that are read only, imagine that we have to make a payment and a field is the amount, I would like to know how I can do to verify that the read-only fields have not been changed.

    
asked by David Sánchez 06.03.2017 в 20:44
source

3 answers

2

If you are working with Spring, I recommend working with group Validations in Spring (@Validated).

If you do a class that implements Validator and is injected through the @InitBinder this class intercepts the request to the controller type class, being able to make standard validations (regex, not null, ....) but also call the base of data or a web service and check if these data are correct and have been modified.

If you give me the concrete example I can tell you the modifications that you have to do in the xml of the context and in the rest of the files.

    
answered by 07.03.2017 в 17:08
1

There are different ways to do this but the easiest way is to put the input that are read that are disabled so the user can not modify them

    
answered by 06.03.2017 в 20:50
1

Personally, I recommend that if you are going to have a field to show the results of a calculation, do not put them as "readonly" inputs, but as elements div or span that you update when necessary.

But the most important thing is that the records you are doing the stores as session variables if possible, since Javascript is vulnerable in these cases.

    
answered by 07.03.2017 в 00:47