users@glassfish.java.net

Re: Prevent eval of JSF rendered attributes from previous page on

From: <glassfish_at_javadesktop.org>
Date: Fri, 25 Apr 2008 09:21:43 PDT

Hi Roy,

Make a trial with <f:attribute>.

<h:outputText value="#{bundle.renderValue}">
<f:attribute name="rendered" value="#{backingBean.renderThisElement}"/>
</h:outputText>

I have had another kind of problem where the rendered attribute with EL caused problem.
For me embeding into c:foreach initiated the problem. The solution was the above.

Manipulating the rendered property as mentioned above can be done by using the binding attribute

<h:outputText binding="#{backingBean.uiComponent}" value="..."/>

class BackingBean{
 UIComponent uiComponent;
...
uiComponent.setRendered(false);
}

(Alternatively you can retrieve the component from from the FacesContext.)

But this kind of manipulation of the component can be failed when you use it in<h:column>
where only one component is binded to a column and only values are saved and restored in the view correctly for each row.

Larc
[Message sent by forum member 'larc' (larc)]

http://forums.java.net/jive/thread.jspa?messageID=271242