You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Simon Kitching (JIRA)" <de...@myfaces.apache.org> on 2005/11/22 05:58:43 UTC

[jira] Commented: (MYFACES-856) t:aliasBean + binding + panelGrid causes exception

    [ http://issues.apache.org/jira/browse/MYFACES-856?page=comments#action_12358216 ] 

Simon Kitching commented on MYFACES-856:
----------------------------------------

UIComponentTag.doStartTag calls encodeBegin() only for components that do *not* render their children. For components like UIPanel that render their children, *no* calls of any sort are made on the component until after all the child components have been created. But that's too late in this case, as the create will fail due to the binding EL being evaluated as the child components are created :-(

I'm looking into whether is is possible to customise the AliasBeanTag class to work around this...

> t:aliasBean + binding + panelGrid causes exception
> --------------------------------------------------
>
>          Key: MYFACES-856
>          URL: http://issues.apache.org/jira/browse/MYFACES-856
>      Project: MyFaces
>         Type: Bug
>     Reporter: Simon Kitching

>
> The following use of t:aliasBean causes an exception:
> ==== including page
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
> <f:view>
>   <h:panelGrid>
>     <t:aliasBean alias="#{target}" value="#{someBean}">
>       <jsp:include page="included.jsp"/>
>     </t:aliasBean>
>   </h:panelGrid>
> </f:view>
> ==== included page
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
> <f:subview id="foo">
>     <h:inputText binding="#{target.input}"/>
> </f:subview>
> The thrown exception is:
> javax.faces.el.PropertyNotFoundException: Base is null: target
>         at org.apache.myfaces.el.ValueBindingImpl.resolveToBaseAndProperty(ValueBindingImpl.java:457)
>         at org.apache.myfaces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:245)
>         at org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:434)
> I believe the problem is that panelGrid renders its children. This means that the components are first created, then the panelGrid iterates over them to render them. However the alias bean hasn't set up the alias at the time the components are being created. And ApplicationImpl.createComponent(binding, context, componentType) is immediately evaluating the binding expression, resulting in the target bean for the binding not being found.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira