How to skip formBackingObject method execution in spring when validation fails.
posted 3 years ago
I am working on a spring 2.5 xml based development and my task is to display some values on form:input tag before the jsp page is called. So I used formBackingObject method to display some values which is fetched from database. It is a edit form basically so I need to display the old value.
My query is when user edit old values and update the new one and click on submit button after which the flow goes to validate(Object target, Errors errors) method if validation fails it will go back to jsp page but before hitting jsp it will call the formBackingObject method and will again fetch the data from database and again the old value will be displayed on jsp.
I want instead of old value the value updated by the user should be display:
for eg : the old value of experience is 5 years and new value updated by user is 6years then if validation fails new value should be displayed and not the old one since the old value is fetched from database when formBackingObject is called and the same is displayed on jsp.