Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Best way to display/not display a div based on a value in my JavaBean

 
Chris Stewart
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JSF, what's the best way to display or not display a div based on the value in one of my JavaBeans? In JSP, I imagine I'd just use Java code to do this, but in JSF I'm told that's a no-no. So, any suggestions?
 
Jason Lee
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chris Stewart:
In JSF, what's the best way to display or not display a div based on the value in one of my JavaBeans? In JSP, I imagine I'd just use Java code to do this, but in JSF I'm told that's a no-no. So, any suggestions?


In "plain" JSF, you can do

<h:panelGroup rendered="...">

Seam offers a s:div, and Facelets offers ui:fragment if you happen to be using either of those.
 
Chris Stewart
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Facelets and ui:fragment did the trick. Thanks for the tip!
 
Jason Lee
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chris Stewart:
I am using Facelets and ui:fragment did the trick. Thanks for the tip!

Very good!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic