Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Rendered attribute of child of unrendered parent  RSS feed

 
Wally Hartshorn
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider this bit of JSF code:

In the above example, the boolean method isFirstTest() is called. If it returns false, we don't want to output either of the child outputText values. If it returns true, then we want to output the first child outputText value ("Hello"), and we might or might not want to output the second child outputText value ("World"), depending upon the result of the call to isSecondTest().

If the first test returns false, I don't want the second test to be performed at all, because it will result in an error. However, what seems to be happening is that the second test being called (triggering the error), even though the it is on a child of an element that is not being rendered.

This seems like incorrect behavior on the part of JSF. Since child elements aren't supposed to be rendered if the parent element isn't rendered, what is the point of performing the rendered test of the child element? Am I misunderstanding something?

(I'm using MyFaces and Tomahawk 1.1.5.)
 
Darryl Nortje
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there Wally,

I am also using MyFaces and Tomahawk. I had to change your code a little to get it to compile first of all. This is what I have.


With this in my bean



and only FIRST TEST gets printed out. So it would seem like this is the behavious you're expecting, and this is the behavious I'm getting. Perhaps change <t:div to <h:panelGroup
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!