Forums Register Login

Rendered attribute of child of unrendered parent

+Pie Number of slices to send: Send
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.)
+Pie Number of slices to send: Send
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
please buy my thing and then I'll have more money:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 3666 times.
Similar Threads
JSF with fileupload and iframe
working with t:commandNavigation2
problem using panelNavigation2 and commandNavigation2
navigationMenuItem inside a dataList
Problem with MyFaces t:popup tag
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:37:07.