• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Rendered attribute of child of unrendered parent

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.)
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
bacon. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic