mojarra icon indicating copy to clipboard operation
mojarra copied to clipboard

JSF input fields not working properly after Validation error

Open 1Kamikazzze1 opened this issue 8 years ago • 0 comments

Hi,

I made a small sample project at the following location: https://github.com/1Kamikazzze1/jsfvalidationerror

The project runs on an tomcat 8.5.15. JSF-API: 2.2 JSF-Impl: 2.2.15 Weld-Servlet: 2.4.5-Final Hibernate-Validator: 6.0.2.Final

In the web.xml there are 2 context parameters set: javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL=true javax.faces.VALIDATE_EMPTY_FIELDS=true

In the example project a small form can be sent to the server. The fields of the backing bean are annotated with bean validation annotations (NotNull and Empty). When the form is submitted the first time and a validation error occurs the validation error messages are printed next to the input fields and the input fields contain the submitted values from the user. This behaviour is expected.

But if the user changes the values in the input fields (the ones with bean validation annotations) and creates an validation error after the first validation error the input fields contain the information which has been sent in the request before. This is not expected. The input fields should always contain the submitted values from the user and the validation error message next to the input field.

Is this a bug?

1Kamikazzze1 avatar Dec 11 '17 14:12 1Kamikazzze1