I wouldn't bet against a bug - handling the el-resolver chain is the most complicated issue in JSF 1.2.
Can you file an issue? regards, Martin On 8/3/07, Paul Dermody <[EMAIL PROTECTED]> wrote: > I have a project that uses MyFaces 1.2.0, Servlets API 2.5, Tiles 2.0.4, > Hibernate 3.2.0, Tomcat 6. Now, I have only recently upgraded to MyFaces > 1.2.0 and the new Servlep API. > > 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!! > > I may be way of track here - but this seems to be a bug or possibly a bad > combination of JARs in my classpath. > > Can anyone confirm that this behaviour is a bug or that the problem lies > elsewhere? > > Thanks, > > Paul Dermody -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces