Hey Leonardo, Thanks for the response, to the best of my knowledge glassfish also made the change to the MapELResolver.java where it always returns "Object.class" for getType(). The JavaDoc can be found here that specifies this should be the case :
http://docs.oracle.com/javaee/5/api/javax/el/MapELResolver.html#getType%28javax.el.ELContext,%20java.lang.Object,%20java.lang.Object%29 I've done some debugging using the Tomcat EL and it looks as though the type of the parameters comes from the MapELResolver (will always return Object.class), so that then when we reach "javax.el.BeanELResolver.invoke (BeanELResolver.java:406)" we can't find the method due to the fact we are looking for method(Object param1, Object param2), rather than method(String param1, String param2). MethodExpressions with parameters look to work under normal circumstances, this seems to be a specific case with f:param, since we are getting the values we are passing to the method from the RequestParameterMap which changes the game due to MapELResolver. I don't have a Glassfish environment available, could you do some quick testing using the application I provided and see if we get the same behavior there? If so then we may need to make a change to MyFaces otherwise we'll be getting this problem when we use either of the EL implementations. Thanks for the help! Regards, Paul Nicolucci Leonardo Uribe <[email protected] > To MyFaces Development 12/06/2011 11:23 <[email protected]> PM cc Subject Please respond to Re: [Discussion] Issue with "MyFaces RequestParameterMap / MapELResolver Development" <[email protected] he.org> Hi Trying some tests I have seen some differences between glassfish EL and tomcat alternative. I suppose the problem is in tomcat, but I haven't investigated too much about that. Sometimes tomcat's bundled EL can't found a method with parameters on the bean. My suggestions is check if there is a bug there. Note the current behavior comply with the spec, so if it is not a but on tomcat's EL, what we can do in MyFaces is a hack to resolve this property as a developer could expect, but this should be disabled by default and I can't really imagine how this should work. It is curious getType() doesn't take advantage of java defined generics to extract the type in this part. Maybe by backward compatibility it returns Object.class, even if like in MYFACES-2552, the user expect other thing. regards, Leonardo Uribe 2011/12/6 Paul Nicolucci <[email protected]>: > > Hello All, > > I have tested MyFaces-2552 and everything seems to work correctly with > Composite Components in my testing however, I have an issue that I have > some concern about and wanted to get some feedback. > > After The following update to the EL: > https://issues.apache.org/bugzilla/show_bug.cgi?id=51177 (which is the > main reason for the fix in MyFaces-2552), I am having an issue using > <f:param/>. For example: > > Page1: > > <h:form id="form1" prependId="false"> > <h:outputScript name="jsf.js" library="javax.faces" > target="head" /> > > <h:commandButton id="button1" value="AddMessage" > action="#{elOperator.addFacesMessage}"/> > <br/> > <br/> > <h:link id="link1" outcome="ELMethodExpression2" value="Link with > Parameters"> > <f:param name="param1" value="param1"/> > <f:param name="param2" value="param2"/> > </h:link> > > <h:messages/> > </h:form> > > Navigates to Page2: > > Page2: > > <h:form id="form1" prependId="false"> > <h:outputScript name="jsf.js" library="javax.faces" > target="head" /> > > <!-- Test method expressions while passing parameters --> > <h:outputText id="out1" > value="#{elOperator.generateStringWithParameters > (param.param1,param.param2)}"/> > > </h:form> > > > Bean Method: > > public String generateStringWithParameters(String param1, String param2) { > return (param1 + ":" + param2); > } > > > When we try to call elOperator.generateStringWithParameters > (param.param1,param.param2) I'm getting the following exception: > > javax.faces.FacesException: java.lang.NoSuchMethodException: > com.ibm.ws.jsf.beans.ELOperatorBean.generateStringWithParameters > (java.lang.Object, java.lang.Object) > at > org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap > (ExceptionHandlerImpl.java:241) > at > org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle > (ExceptionHandlerImpl.java:156) > at org.apache.myfaces.lifecycle.LifecycleImpl.render > (LifecycleImpl.java:258) > at javax.faces.webapp.FacesServlet.service > (FacesServlet.java:191) > at com.ibm.ws.webcontainer.servlet.ServletWrapper.service > (ServletWrapper.java:1188) > at > com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest > (ServletWrapper.java:763) > at > com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest > (ServletWrapper.java:454) > at > com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest > (ServletWrapperImpl.java:178) > at > com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters > (WebAppFilterManager.java:1020) > at > com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest > (CacheServletWrapper.java:87) > at com.ibm.ws.webcontainer.WebContainer.handleRequest > (WebContainer.java:895) > at com.ibm.ws.webcontainer.WSWebContainer.handleRequest > (WSWebContainer.java:1662) > at com.ibm.ws.webcontainer.channel.WCChannelLink.ready > (WCChannelLink.java:195) > at > com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination > (HttpInboundLink.java:452) > at > com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest > (HttpInboundLink.java:511) > at > com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest > (HttpInboundLink.java:305) > at > com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete > (HttpICLReadCallback.java:83) > at > com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted > (AioReadCompletionListener.java:165) > at com.ibm.io.async.AbstractAsyncFuture.invokeCallback > (AbstractAsyncFuture.java:217) > at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions > (AsyncChannelFuture.java:161) > at com.ibm.io.async.AsyncFuture.completed > (AsyncFuture.java:138) > at com.ibm.io.async.ResultHandler.complete > (ResultHandler.java:204) > at com.ibm.io.async.ResultHandler.runEventProcessingLoop > (ResultHandler.java:775) > at com.ibm.io.async.ResultHandler$2.run > (ResultHandler.java:905) > at com.ibm.ws.util.ThreadPool$Worker.run (ThreadPool.java:1659) > Caused by: java.lang.NoSuchMethodException: > com.ibm.ws.jsf.beans.ELOperatorBean.generateStringWithParameters > (java.lang.Object, java.lang.Object) > at java.lang.Class.throwNoSuchMethodException (Class.java:282) > at java.lang.Class.getMethod(Class.java:853) > at javax.el.BeanELResolver.invoke (BeanELResolver.java:406) > at javax.el.CompositeELResolver.invoke > (CompositeELResolver.java:137) > at org.apache.el.parser.AstValue.getValue (AstValue.java:159) > at org.apache.el.ValueExpressionImpl.getValue > (ValueExpressionImpl.java:283) > at > org.apache.myfaces.view.facelets.el.TagValueExpression.getValue > (TagValueExpression.java:85) > at javax.faces.component._DeltaStateHelper.eval > (_DeltaStateHelper.java:243) > at javax.faces.component.UIOutput.getValue (UIOutput.java:71) > at > org.apache.myfaces.shared_impl.renderkit.RendererUtils.getValue > (RendererUtils.java:343) > at > org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue > (RendererUtils.java:295) > at > org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderOutput > (HtmlTextRendererBase.java:92) > at > org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd > (HtmlTextRendererBase.java:79) > at javax.faces.component.UIComponentBase.encodeEnd > (UIComponentBase.java:519) > at javax.faces.component.UIComponent.encodeAll > (UIComponent.java:626) > at javax.faces.component.UIComponent.encodeAll > (UIComponent.java:622) > at javax.faces.component.UIComponent.encodeAll > (UIComponent.java:622) > at javax.faces.component.UIComponent.encodeAll > (UIComponent.java:622) > at > org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView > (FaceletViewDeclarationLanguage.java:1320) > at org.apache.myfaces.application.ViewHandlerImpl.renderView > (ViewHandlerImpl.java:263) > at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute > (RenderResponseExecutor.java:85) > at org.apache.myfaces.lifecycle.LifecycleImpl.render > (LifecycleImpl.java:239) > ... 22 more > > > Since the MapELResolver.java in the EL Implementation always returns > "Object.class" from getType() and the parameters are stored in the > RequestParameterMap we are now looking for a method signature using Object > instead of the expected type String. > > Has an issue already been opened for this? Suggestions on how to go about > fixing this? I've attached a simple test case that reproduces -> Navigate > to the ELMethodExpression.jsf page and then press the link -> the exception > appears. > > Thanks for the help! > > (See attached file: JSF20EL.war) > > Regards, > > Paul Nicolucci
