This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JSF and the fly likes Crash when dataTable is empty Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Crash when dataTable is empty" Watch "Crash when dataTable is empty" New topic
Author

Crash when dataTable is empty

Dmitriy Kastikovich
Greenhorn

Joined: Jun 29, 2008
Posts: 22
I have a condition inside columns and it seems dataTable process it when no date from getter for data for dataTable. So, I solve problem by adding one line and with disabling rednering. But I think, it is not a good solution.

And you?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14568
    
    7

I don't put logic in my View (JSF page). Logic is what I put in the model (Backing Bean).

JSF was not intended to split program logic between model, view, and controller components and people frequently have problems when they try and do that.


Customer surveys are for companies who didn't pay proper attention to begin with.
Dmitriy Kastikovich
Greenhorn

Joined: Jun 29, 2008
Posts: 22
del
Dmitriy Kastikovich
Greenhorn

Joined: Jun 29, 2008
Posts: 22
Sorry-sorry-sorry... I haven't condition in JSF code. it looks like this:



And when list in bean is empty it crashes: javax.servlet.ServletException: Missing 'rows' attribute on component 'requests'
but I have it:
>
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14568
    
    7

Actually, you do have conditions ("var.status = true"). But that one should be safe, although it's redundant. You don't have to compare a boolean to true/false, so you can just code it as 'rendered="#{var.status}"'.

I think you're missing some of your sample code, which may be because we just went online with new forum software (yes, the JavaRanch is now actually coded in Java!).

But specifying rows="0" makes no sense, so you may be triggering a bug. The "rows" attribute isn't used to indicate the amount of data you have, it's used to limit the maximum number of rows that will display. Normally, I set it to around 10 to 20 and add a page control if there's possibly more data than that. That way I can keep the displayed page to something that's fairly readable.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Tim Holloway wrote:Actually, you do have conditions ("var.status = true"). But that one should be safe, although it's redundant. You don't have to compare a boolean to true/false, so you can just code it as 'rendered="#{var.status}"'.
Note that he is comparing them as strings instead of booleans.


Code depot of a Java EE / JSF developer | JSF / Eclipse / Tomcat kickoff tutorial | DAO kickoff tutorial | I ♥ Unicode
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Crash when dataTable is empty
 
Similar Threads
datatable contents not updating
hi light a perticular row in jsf datatable
problem with c:forEach and links
Problem with selecting checkboxes in subTable
Showing a List of Maps in a dataTable