• Post Reply Bookmark Topic Watch Topic
  • New Topic

Crash when dataTable is empty

 
Dmitriy Kastikovich
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 18411
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dmitriy Kastikovich
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
del
 
Dmitriy Kastikovich
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 18411
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!