• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JSF table

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you tell me how you are associating the values to the dataTable?

Are you using arraylist?
 
Bakya Lakshmi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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}">
 
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

HTH
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Easiest way:





Stupid getter method name by the way. If you can invent something more elegant, let it know ;)
 
I guess everyone has an angle. Fine, what do you want? Just know that you cannot have this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic