File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Showing ' No Records available' message in a h:dataTable    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Showing Watch "Showing New topic

Showing ' No Records available' message in a h:dataTable

Francis Lukose

Joined: Aug 03, 2005
Posts: 4
Hi ,

I am using JSF dataTable to show my data in tabular format. The data is comming from a database. And everything is working finely.
But I would like to show a message like " No Records Available" in the dataTable if there has no data to be shown.

Is it possible to show these type of messages in a dataTable?

Could anybody please give a solution?

Ravindra Rawat
Ranch Hand

Joined: Dec 09, 2004
Posts: 34
Hi Francis,

If you are using myfaces,
use renderedIfEmpty="false" (Why, checkout the taglib documentation)

If some other implementation.
rendered="#{bean.size != 0}"

After this you can have a outputText component which is has

rendered="#{bean.size == 0}" and the message you want to display on no records.

In short, use the rendered attribute.

Warm Regards
jQuery in Action, 3rd edition
subject: Showing ' No Records available' message in a h:dataTable
It's not a secret anymore!