• Post Reply Bookmark Topic Watch Topic
  • New Topic

Rendered attribute not working

 
J Miller
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I’m having a problem with the “rendered” attribute of the <hutputText> and <hutputLink> tags. Basically, the functionality I’m trying to achieve is this:

If a certain field contains something, it appears as a link. If the contents are null or empty, it should appear as text saying “N/A”.

To accomplish this, I’ve added a test to my class that checks the contents of that variable, and returns two values. One value is for the text, and one is for the link, both return either “true” or “false”. If there is something in the variable, then #{customer.customerIdText} returns "false", and #{customer.customerIdLink} returns "true". If there is nothing in the variable, then the opposite happens. Here's how my code snippet looks:



I'm currently also showing the value of the #{customer.customerIdLink} and #{customer.customerIdText} on the page, and both of them ARE returning the correct values. The problem is that nothing at all shows up on the page, neither the link OR the text. It's just blank. I've double checked with the JSF tag library, and both the [outputLink|http://download.oracle.com/docs/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/pdldocs/jsp/h/outputLink.html] and [outputText|http://download.oracle.com/docs/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/pdldocs/jsp/h/outputText.html] tags DO support the "rendered" attribute.

Any ideas why this isn't working?
 
Ilari Moilanen
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You logic seems fine to me...

However, I am not familiar with Richfaces but are you sure you can put content directly inside rich:columnGroup?

Does for example this show on you page?or do you need to add a column like this
 
J Miller
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so I got this fixed, and it was related to two things. First off, the rendered attribute must evaluate to a boolean, and I was returning a string. Second, for some reason the <rich:columnGroup> was causing problems. I changed it to a boolean, and lost the columngroup, and now it works!.

Thanks for the response!


 
Ilari Moilanen
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The returning strings would have been my second guess
I actually thought of that too since you talked about "true" and "false" instead of true and false but then I disregarded that thought since why would you return strings when the tag expects booleans. Well that just shows that I should never assume anything...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!