This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JSF and the fly likes Conditional logic in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSF
Bookmark "Conditional logic in JSF" Watch "Conditional logic in JSF" New topic

Conditional logic in JSF

Kalyan Anand
Ranch Hand

Joined: Feb 07, 2007
Posts: 194
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

Joined: Feb 07, 2007
Posts: 194
Any answers on this one ???
Rodrigo Lazoti

Joined: Mar 13, 2009
Posts: 9
You're can use the rendered attribute. Example:

Rodrigo Lazoti.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16101

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.

Customer surveys are for companies who didn't pay proper attention to begin with.
GeeCON Prague 2014
subject: Conditional logic in JSF