Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Conditional logic in JSF  RSS feed

 
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
Bartender
Posts: 18662
71
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
Boost this thread!