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

Conditional logic in JSF

 
Kalyan Anand
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code in JSF which displays a Settings URL . The URL needs to be hiiden when the parameter is null.

I was thinking about the best approach to do it. The obvious and easitest approach I see is using JSP <c:if>. Any thoughts on how this can be pertformed with other mechanisms and which one is considered better appproach ?

 
Kalyan Anand
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any answers on this one ???
 
Rodrigo Lazoti
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're can use the rendered attribute. Example:

 
Tim Holloway
Saloon Keeper
Pie
Posts: 18167
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to be pedantic (or was that p├Ždantic?), conditional logic (meaning business logic or wholesale rearrangement of view components) is something that you should not place in a View. It's a violation of the MVC separation of concerns.

Conditional rendering, on the other hand, is another matter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic