[ 
https://issues.apache.org/jira/browse/MYFACES-1670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12519142
 ] 

Bernhard Huemer commented on MYFACES-1670:
------------------------------------------

The problem is a legacy PropertyResolver being required by the JSF 1.2 
specification (org.apache.myfaces.el.DefaultPropertyResolver). This 
PropertyResolver just has to call 
"FacesContext.getCurrentInstance().getELContext().setPropertyResolved(false);" 
(see JSF 1.2 specification, 5.8.2). However, if the container is evaluating an 
expression, it uses its own ELContext implementation (e.g. 
org.apache.jasper.el.ELContextImpl).

At the beginning I've said that the problem is the legacy PropertyResolver, but 
that's not really the case as its expected behaviour is described in the 
specification. Actually, the adapter class making it possible to use 
PropertyResolvers in the ELResolver chain is incorrect. Before delegating the 
request to the PropertyResolver it assumes that the property will be resolved 
and therefore calls "context.setPropertyResolved(true);". This behaviour is  
also according the specification if I haven't got it wrong (5.6.1.6). If the 
PropertyResolver is not able to fulfill the task it just has to call 
"context.setPropertyResolved(false);", but remember that a PropertyResolver 
just knows how to access the FacesELContext. 

Therefore the adapter class has to inform its given context whether the 
property has been resolved or not according to the FacesELContext. I'll attach 
a patch.

> A dollar-type, 2 level EL expression evaluates to null
> ------------------------------------------------------
>
>                 Key: MYFACES-1670
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1670
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-252
>    Affects Versions: 1.2.1-SNAPSHOT
>         Environment: geronimo-2.0-M6-rc1
>            Reporter: Alexander Zynevich
>             Fix For: 1.2.0-SNAPSHOT
>
>         Attachments: Customer.java, CustomerDetailsBean.java, eltest.war, 
> faces-config.xml, print.jsp, web.xml
>
>
> I have a simple code where dollar-type expression (like ${}) works 
> differently than shrap-type  expression (like #{}),
> I put into the http session a managed bean aggregating another bean.
> ${parent} is calculated, while ${parent.child} is always null (it is printed 
> as an empty string and equals to null in "when" tag).
> For example the following snip of JSP code:
>    <f:view>
>     <h:form id="myform" >
>     <b>Using sharp-el</b>: <br/>
>     *<h:outputText id="cll1" value="#{customerDetailsBean}" />*<br/>
>     *<h:outputText id="cll2" value="#{customerDetailsBean.customer}" />*<br/>
>     <b>Using dollar-el</b>: <br/>
>     *${customerDetailsBean}*<br/>
>     *${customerDetailsBean.customer}*<br/>
>     <b>Classical "servlet" style</b>: <br/>
>     *<% if (session.getAttribute("customerDetailsBean") != null) {%><%= 
> session.getAttribute("customerDetailsBean") %><% } %>*<br/>
>     *<% if (session.getAttribute("customerDetailsBean") != null) {%><%= 
> ((eltest.CustomerDetailsBean)session.getAttribute("customerDetailsBean")).getCustomer()
>  %><% } %>*<br/>
>     </h:form>
>     </f:view>
> -- PRODUCES --:
>     Using sharp-el:
>     *CustomerDetailsBean: { customer: Customer {frstName: Alex , lastName: 
> Zynevich, id: 1979}}*
>     *Customer {frstName: Alex , lastName: Zynevich, id: 1979}*
>     Using dollar-el: 
>     *CustomerDetailsBean: { customer: Customer {frstName: Alex , lastName: 
> Zynevich, id: 1979}}*
>     **
>     Classical "servlet" style:
>     *CustomerDetailsBean: { customer: Customer {frstName: Alex , lastName: 
> Zynevich, id: 1979}}*
>     *Customer {frstName: Alex , lastName: Zynevich, id: 1979}*
> while I would expect:
>     Using sharp-el: 
>     *CustomerDetailsBean: { customer: Customer {frstName: Alex , lastName: 
> Zynevich, id: 1979}}*
>     *Customer {frstName: Alex , lastName: Zynevich, id: 1979}*
>     Using dollar-el: 
>     *CustomerDetailsBean: { customer: Customer {frstName: Alex , lastName: 
> Zynevich, id: 1979}}*
>     *Customer {frstName: Alex , lastName: Zynevich, id: 1979}*
>     Classical "servlet" style: 
>     *CustomerDetailsBean: { customer: Customer {frstName: Alex , lastName: 
> Zynevich, id: 1979}}*
>     *Customer {frstName: Alex , lastName: Zynevich, id: 1979}*
> you may find the maven project at 
> https://issues.apache.org/jira/browse/GERONIMO-3253, war is attached

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to