• Post Reply Bookmark Topic Watch Topic
  • New Topic

h:panelGroup rendered attribute  RSS feed

 
Christopher De Castro
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm still trying to learn basic JSF and was wondering why this code isn't working:



I have a context parameter called DEPLOY_ENV whose value is currently set to "(DEV)". The first row in my table shows up correctly, but the second row that I'm expecting (a tr with a background of my_image.gif) isn't showing up. Is there anything wrong with my rendered attribute?

Thanks in advance!
 
Paolo Pinkel
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I usually use ne instead of != and eq instead of ==. But I don't know if it has anything to do with this.
 
Tim Holloway
Bartender
Posts: 18663
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, your panelGroup is inconsistent with your use of raw HTML for the table, for one thing. You'd typically use panelGroup with panelGrid and dispense with the HTML tags altogether.

However, panelGroup is for putting multiple things in one column that would normally each get their own separate column, not for optional rows. I'm pretty sure, however, that if you don't render anything in a given set of columns for a row that the JSF renderer won't render an empty row, but instead not render the row at all.

I don't recommend getting too creative in EL. It can be hard to debug, since it's not interpreted until runtime (and for that reason can also blow up at inconvenient moments on a production system), and it makes the View source more complicated. So I'd generally replace "#{initParam['DEPLOY_ENV'] == '(DEV)'}" with something like "#{initParamBean.deployDev}" and let the boolean deployDev property of initParamBean handle the actual logic.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!