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

Mario Ivankovits commented on MYFACES-856:
------------------------------------------

You are right, these are the downsides of this solution, but as I said, it isnt 
a solution its a HACK.

Even if you put your aliasbean directly after f:view, the aliased binding cant 
be resolved if you dont call "makeAlias".


You might also have a look at MYFACES-334 (reported by me ;-) )

There Mathias Broekelmann pointed out another solution. Mainly to bind against 
a non aliased request bean which acts as an interface, though, this leads to 
not well maintainable code I think.

Might it be possible to treat aliases static and thus, once the binding has 
been resolved, to rewrite the binding information directly in the component?

> 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