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

Reply via email to