5 Replies Latest reply on Apr 3, 2007 8:21 AM by mgrouch

    EL Enhancements dont work in facelets tag file

    Dustin Norlander Apprentice

      Hello,

      I'm not sure if you would consider this a bug, but it took me all day to figure out where the problem was. Hopefully this will help someone out, if it is fixable I can attach a very simple example.

      Problem: parameters passed to facelets tag files are always null when used in an action.

      Examlpe tag file (exampleTag.xhtml):

      <s:fragment
       xmlns="http://www.w3.org/1999/xhtml"
       xmlns:h="http://java.sun.com/jsf/html" >
      
       Value is: #{value}
       <h:form>
       <h:commandLink action="#{exBean.echo( value )}" value="Click Me!"/>
       </h:form>
      </s:fragment>
      


      Where exBean.echo just prints the value to std out. The value is displayed correctly on the rendered page, but is always null when passed to the action. This is obviously a problem of scope.

      Here are the other files needed to reproduce..

      (example.taglib.xml)

      <?xml version="1.0"?>
      <!DOCTYPE facelet-taglib PUBLIC
       "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
       "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
      
      <facelet-taglib>
       <namespace>http://www.example.com/tags</namespace>
       <tag>
       <tag-name>exampleTag</tag-name>
       <source>exampleTag.xhtml</source>
       </tag>
      </facelet-taglib>
      



      usage:
      (home.xhtml)
      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ex="http://www.example.com/tags"
       template="layout/template.xhtml">
      
      <ui:define name="body">
       <ex:exampleTag value="Hello!" />
      </ui:define>
      </ui:composition>
      


        • 1. Re: EL Enhancements dont work in facelets tag file
          M Bol Newbie

          I am having similar problem. I am using facelets source tag:

          taglib.xml

          <facelet-taglib>
           <namespace>http://Test</namespace>
           <tag>
           <tag-name>test</tag-name>
           <source>Test.xhtml</source>
           </tag>
          </facelet-taglib>


          Test.xhtml (source of test tag)
          <ui:composition xmlns="http://www.w3.org/1999/xhtml" ...>
           <h:commandLink action="#{backingBean.test('123')}">
           testWithParam
           </h:commandLink>
           <h:commandLink action="#{backingBean.testNoParam}">
           testNoParam
           </h:commandLink>
          </ui:composition>
          


          some xhtml file using test tag
          <ui:composition xmlns="http://www.w3.org/1999/xhtml" ...
           xmlns:t="http://Test">
           <t:test backingBean="#{testBean}"/>
          </ui:composition>




          Link testNoParam is working.
          Link testWithParam is NOT working. I get exception:


          11:15:57,258 ERROR [ExceptionFilter] uncaught exception
          javax.servlet.ServletException: Error calling action method of component with id test:_id54
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
          at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
          at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
          at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
          at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
          at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
          at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
          at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
          at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
          at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)



          I am using seam 1.2.1GA, project was created using seam-gen.


          • 2. Re: EL Enhancements dont work in facelets tag file
            M Bol Newbie

            Complete stacktrace of exception:

            javax.faces.FacesException: Error calling action method of component with id orgUnitDetail:_id66
            at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:79)
            at javax.faces.component.UICommand.broadcast(UICommand.java:106)
            at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
            at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
            at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:329)
            at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
            at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
            at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
            at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
            at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
            at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
            at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
            at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
            Caused by: java.lang.NullPointerException:
            at org.jboss.seam.ui.facelet.MethodExpressionHelper.findParamTypes(MethodExpressionHelper.java:146)
            at org.jboss.seam.ui.facelet.MethodExpressionHelper.invokeTheExpression(MethodExpressionHelper.java:98)
            at org.jboss.seam.ui.facelet.ParamMethodExpression.invoke(ParamMethodExpression.java:62)
            at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
            at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
            at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
            at javax.faces.component.UICommand.broadcast(UICommand.java:106)
            at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
            at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
            at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:329)
            at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
            at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
            at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
            at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
            at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
            at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
            at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
            at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

            • 4. Re: EL Enhancements dont work in facelets tag file
              M Bol Newbie

              Anyone understands suggested workaround by Andrew Wheeler in bug comments?

              • 5. Re: EL Enhancements dont work in facelets tag file
                mgrouch Expert

                If you want to use action binding passed as parameter in facelets here is the article how to do that

                http://andrewfacelets.blogspot.com/2006/06/creating-composite-controls-with-jsf.html

                --MG