posted 8 years ago
I've created a custom component called conditionalDisplay. It has an action (hide/display), comparison (equals or isNull), and value1/value2. Value1 and Value2 are compared if the comparison is 'equals' and if they are equal, the specific action should be performed. This is helpful when there is a little more complicated logic than normal and it provides a different interface than just adding the boolean result in the bean class.
My trouble is getting the children tags not to render. It has no problem rendering, but when the action is 'display', the comparison is 'equals', and the values don't match it still renders. It seems like using the setRendered method in the encodeBegin method should work, but it continues to render the children.
In the simple example below, when the Bean.client equals 'YYY' the div tag should display and that part works fine. However, when the client is anything else, say 'AAA', the div tag should not be rendered. I've followed the code through the debugger and found that it's setting the setRendered method to false, but it's still rendered. Do you know why it is still rendering or what I need to do in the logic so that it doesn't render?
ConditionalDisplayTag.java
UIComponentBaseTag.java
index.xhtml