user679526
user679526

Reputation: 845

JSF 2.0 Validation errors result the input fields to display local values instead of updated model values

The application uses JSF 2.0 framework. User inputs values to a form. When user selects save, some fields have validation errors and some don't. User clicks on cancel button. Then user clicks the update button again. Even though the modal values are updated, the fields which had valid values when save was selected display the local values instead of the updated model values.

I solved this issue by adding a resetValues() method in the action method of cancel. The resetValues() loops through the list of children and reset the local values to null.

Is there a better solution for this problem to improve the performance of the application?

Upvotes: 1

Views: 781

Answers (1)

BalusC
BalusC

Reputation: 1108632

The cancel button should recreate the view. You can do it by returning a navigation outcome to the same view, if necessary with faces-redirect=true.

Upvotes: 2

Related Questions