*
The moose likes JSF and the fly likes Binding 'rendered' with non-boolean value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Binding Watch "Binding New topic
Author

Binding 'rendered' with non-boolean value

Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
I want to display some value only if it fulfills some condition.

In the following code, I want to render the <hutputText> only if item.pc_hdd > 0.


This value is int, so binding the rendered property with it, was of no use. How can we do this? Any ideas shall help!

Thanks
Abhishek
Akbar Basha R
Greenhorn

Joined: Mar 11, 2002
Posts: 23
Try using the JSTL logic tags,



The logic tags are in "http://java.sun.com/jstl/core"

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
No need for JSTL here. The rendered attribute accepts every boolean expression.

Soshould work.
Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
Heyy thanks both of you. I used the boolean expression method and it worked.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You're welcome.

To get an idea what's all possible with EL to get a boolean outcome, here are some examples:
 
 
subject: Binding 'rendered' with non-boolean value
 
Similar Threads
How do I conditionally output text in JSF?
JSF check if message is empty
JSF datatable
JSF + RichFaces not able to reRender
JSF dataTable issue