You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Andrew Robinson <an...@gmail.com> on 2008/07/23 00:49:33 UTC

Re: [Trinidad] question about the binding attribute when a parent copmonent is setting rendered to false

The binding EL is executed during JSP tag execution (or facelets
TagHandler apply). At that time the component is created. Specifically
what happens:

1) Tag code evaluates binding to see if the component exists (your
bean created here and the getter called)
2) If component is null
2a) create the component
2b) set the binding expression using the component (you setter called here)

-Andrew

On Tue, Jul 22, 2008 at 4:43 PM, Justin mcKay <ju...@gmail.com> wrote:
> I have a question about  the binding attribute  when a parent copmonent is
> setting rendered to false.  Say I have a panelGroupLayout tag that has the
> rendered attribute set to false.  Then a child to that panelGroupLayout is
> an inputText tag that has  the attribute binding set to a backing bean.  My
> assumption was since the binding was the only reference to the backing bean
> and the component is not being rendered (based on the parent) then the bean
> should not be created and the set method to the binding should not be
> fired.  However the bean is still created and the binding is still set.  Is
> this correct?
>
>
>
> I provided the sample code below….
>
>
>
> Java Code….
>
>
>
> public class CheckBinding {
>
>       private CoreInputText textComp;
>
>
>
>       public CheckBinding(){
>
>             System.out.println("Bean is being created");
>
>       }
>
>
>
>       /**
>
>        * @param textComp the textComp to set
>
>        */
>
>       public void setTextComp(CoreInputText textComp) {
>
>             this.textComp = textComp;
>
>       }
>
>
>
>       /**
>
>        * @return the textComp
>
>        */
>
>       public CoreInputText getTextComp() {
>
>             return textComp;
>
>       }
>
> }
>
>
>
> JSF Code….
>
>
>
> <tr:form>
>
>       <tr:panelGroupLayout rendered="false">
>
>             <tr:inputText binding="#{testBinding.textComp}"></tr:inputText>
>
>       </tr:panelGroupLayout>
>
> </tr:form>
>
>
>
> Bean Definition…
>
>
>
> <managed-bean>
>
>       <managed-bean-name>testBinding</managed-bean-name>
>
>
> <managed-bean-class>com.faces.bean.test.CheckBinding</managed-bean-class>
>
>       <managed-bean-scope>request</managed-bean-scope>
>
> </managed-bean>
>
>
>
>
>
>
>
>