This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSF and the fly likes rendered attribute of output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSF
Bookmark "rendered attribute of output" Watch "rendered attribute of output" New topic

rendered attribute of output

E Paisley

Joined: Sep 22, 2008
Posts: 14
Can you use a function inside of the rendered attribure?

Rendered takes a true/false value. What I'm trying to do is compare to backing bean values to determine if link should be displayed. Something like this:

rendered="#{!(frCodeBeingDisplayed == loggedInAs)}"

The above doesn't work. What I have found is that you can set rendered to a backing bean value (True or False), but I haven't found anything on a function that results in a true or false.

Can you set a function to a rendered attribute? Any suggestions would be appreciated
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You can use conditional expressions in EL. Maybe you just did it the wrong way. You didn't give enough information to give you the right answer. If you for example need to compare some value with a String, then you can do it as follows:
E Paisley

Joined: Sep 22, 2008
Posts: 14
I did end up getting it to work...

The following statements will work in the rendered attribute.

Have you checked out Aspose?
subject: rendered attribute of output
It's not a secret anymore!