File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes JSF table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF table" Watch "JSF table" New topic

JSF table

Bakya Lakshmi

Joined: Dec 10, 2008
Posts: 9
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.
Kumaresh Vidhyasagar
Ranch Hand

Joined: Dec 05, 2008
Posts: 30
Can you tell me how you are associating the values to the dataTable?

Are you using arraylist?
Bakya Lakshmi

Joined: Dec 10, 2008
Posts: 9
I am using a list which stores the value retrieved from database.
I am binding the list with the tabe using the following syntax.
<h:dataTable id="table1" value="#{SearchMbean.suspenslist}">
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

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.


My Blog SCJP 5 SCWCD 5
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Easiest way:

Stupid getter method name by the way. If you can invent something more elegant, let it know ;)
I agree. Here's the link:
subject: JSF table
It's not a secret anymore!