File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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: 17410

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Conditional logic in JSF
jQuery in Action, 3rd edition