[
https://issues.apache.org/jira/browse/MYFACES-1697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518149
]
Eyal Lupu commented on MYFACES-1697:
------------------------------------
One more input:
It happens also in immediate expressions which are OUTSIDE the <f:view>. The
reason is the same: The base is resolved correctly, but the property is badly
resolved (or actually not resolved at all) by the DefaultPropertyResolver. It
just returns null.
As a temporary workaround I registered my own el-resolver (actually I used the
javax.el.BeanELResolver) - it works but now I also have to register the Map and
List EL resolvers. It worked.... but on some pages is crashes when trying to
convert deferred expressions from strings to MethodExpression (it is
interesting since sometime
MyFaces does successfully do the conversion). Anyway - this is to internal,
unstable and with side affects to be a workaround - so for now we have decided
to keep with 1.1.4.
> Immediate EL expressions not resolved correctly
> -----------------------------------------------
>
> Key: MYFACES-1697
> URL: https://issues.apache.org/jira/browse/MYFACES-1697
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-252
> Affects Versions: 1.2.0
> Environment: This is happening to me on a project that uses MyFaces
> 1.2.0, Servlets API 2.5, Tiles 2.0.4, Hibernate 3.2.0, Tomcat 6. I have only
> recently upgraded to MyFaces 1.2.0 and the new Servlep API. OS is Windows.
> Reporter: Paul Dermody
>
> Recently I tried to start using immediate JSP EL expressions but I am getting
> an odd behaviour which I would like to know if anyone else has seen.
>
> In my mfaces-config.xml I have the following Managed bean defined:
>
> <managed-bean>
> <managed-bean-name>myDate</managed-bean-name>
> <managed-bean-class>java.util.Date</managed-bean-class>
> <managed-bean-scope>session</managed-bean-scope>
> </managed-bean>
>
> I have a JSP that contains the following:
>
> <f:view>
> <h:panelGrid columns="1">
> <h:outputText value="myDate=#{myDate}" />
> <h:outputText value="myDate.time=#{myDate.time} " />
> <f:verbatim>
> myDate = ${myDate}<br>
> myDate.time = ${myDate.time}
> </f:verbatim>
> </h:panelGrid>
> </f:view>
>
> The output I am getting for this code is as follows:
>
> myDate=Fri Aug 03 11:52:31 CST 2007
> myDate.time=1186163551316
> myDate = Fri Aug 03 11:52:31 CST 2007
> myDate.time =
>
> This behaviour is clearly wrong. For some reason the immediate EL expression
> is not resolving the time property correctly.
>
> I debugged this in Eclipse and I found that the "time" segment of the EL
> expression is being resolved to 'null' via a sequence of calls that
> eventually leads to the following stack trace:
>
> date.jsp line: 10
> org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(String,
> Class, javax.servlet.jsp.PageContext,
> org.apache.jasper.runtime.ProtectedFunctionMapper, boolean) line: 923
> org.apache.el.ValueExpressionImpl.getValue(javax.el.ELContext) line: 186
>
> org.apache.el.parser.AstValue.getValue(org.apache.el.lang.EvaluationContext)
> line: 97
> javax.el.CompositeELResolver.getValue( javax.el.ELContext, Object,
> Object) line: 53
>
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(javax.el.ELContext,
> Object, Object) line: 104
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.invoke
> (org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.ResolverInvoker<T>)
> line: 148
>
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver$4.invoke()
> line: 108
>
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.access$301
> (org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver,
> javax.el.ELContext, Object, Object) line: 46
>
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver(javax.el.CompositeELResolver).getValue(
> javax.el.ELContext, Object, Object) line: 53
>
> org.apache.myfaces.el.convert.PropertyResolverToELResolver.getValue(javax.el.ELContext,
> Object, Object) line: 106
> org.apache.myfaces.el.convert.PropertyResolverToELResolver.invoke
> (javax.el.ELContext, Object, Object,
> org.apache.myfaces.el.convert.PropertyResolverToELResolver.ResolverInvoker<T>)
> line: 193
>
> org.apache.myfaces.el.convert.PropertyResolverToELResolver$3.invoke(Object,
> Object) line: 115
> org.apache.myfaces.el.DefaultPropertyResolver.getValue(Object, Object)
> line: 64
> The source of the deepest function is as follows:
>
> public Object getValue(Object base, Object property) throws
> EvaluationException, PropertyNotFoundException
> {
> updatePropertyResolved();
> return null;
> }
>
> The updatePropertyResolved() function looks like this:
>
> private void updatePropertyResolved()
> {
>
> FacesContext.getCurrentInstance().getELContext().setPropertyResolved(false);
> }
> This function is setting the propertyResolved flag to false in the "current"
> ELContext. This is necessary since the propertyResolved flag is set to true
> before every call to each resolver. The current ELContext is of type
> org.apache.myfaces.el.unified.FacesELContext and eclipse says it's id is 313.
>
> However, when I look further up the stack it turns out that the
> FacesCompositeELResolver checks to see if the "time" segment was resolved by
> checking the value of the propertyResolved flag in a context object of type
> org.apache.el.lang.EvaluationContext with id 266. Confusingly, this context
> object delegates it's work to a different context object of type
> org.apache.jasper.el.ELContextImpl with id 259. The point here is that it
> seems to me that the wrong context object is being used somewhere - the
> propertyResolved flag is being set in one object but check in a different
> object!!
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.