I have a JSF page which displays a table based on list retrieved from database depending on some input field value entered by User.
But if their is any validationerror on the page, the list remains the same.But i want the list to be null( i.e) the table should be empty if there is any validation error. How can i do that?i am using h:datatable to display the list.
What I can suggest is you can provide a boolean member in the backing bean that will set to true only if there are no validations error. If there is any validation error then the value of that boolean field will be false.
Then you bind that boolean field to the rendered attribute of your <h:dataTable>
In this case the table will be shown only when there are no validation errors.