2 Replies Latest reply on Jan 7, 2008 3:06 AM by rizzojo

    Extended EL support (with parameters) -> MethodNotFoundExcep

    rizzojo

      Hi, I'm a Seam newbie trying to learn it.

      I've an issue with the use of extended EL in datatables to pass parameters.

      I can make the booking example (tutorial) work and it uses that feature.
      But I cannot make it work for my project.

      (fragment of) The xhtml code of the table:

       <h:dataTable var="usr" value="#{userList}" rendered="#{userList.rowCount>0}">
       <h:column>
       <f:facet name="header">
       <h:outputText value="User Name"/>
       </f:facet>
       #{usr.userName}
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="User ID"/>
       </f:facet>
       <s:link value="#{usr.id}" action="#{userEdit.selectUser(usr)}"/>
       <s:link value="#{usr.id}" action="#{userEdit.selectTest}"/> User(usr)
       </h:column>
      
       </h:dataTable>
      


      This table contains 2 columns with:
      - #{usr.userName}
      - links with #{usr.id}

      In the second column, the first link has a parameter
      <s:link value="#{usr.id}" action="#{userEdit.selectUser(usr)}"/>
      and the other link has no parameter (other method)
      <s:link value="#{usr.id}" action="#{userEdit.selectTest}"/>

      Here is the Java code of the "userEdit" seam bean, which is a SFSB.

      @Stateful
      @Scope(EVENT)
      @Name("userEdit")
      public class UserEditAction implements UserEdit {
       ....
       public void selectUser(UserProfile selectedUser) {
       System.out.println("EDITINGUSER Selected: "+ editingUser);
       }
      
       public void selectTest(){
       System.out.println("LINK WORKS");
       }
      }
      



      The Problem:

      The first link (with the parameter, extended EL) does not work, while the second link (no parameter, standard EL) works well.

      In the browser, here are the urls of each links:
      1ST:
      http://localhost:8080/TestWeb/userlist.seam?dataModelSelection=usr%3AuserList%5B0%5D&conversationId=4&actionMethod=userlist.xhtml%3AuserEdit.selectUser%28usr%29

      2ND:
      http://localhost:8080/TestWeb/userlist.seam?dataModelSelection=usr%3AuserList%5B0%5D&conversationId=4&actionMethod=userlist.xhtml%3AuserEdit.selectTest

      On the JBoss console, seam produces a stack trace when clicking the first link.

      15:30:54,735 ERROR [SeamPhaseListener] uncaught exception
      javax.el.MethodNotFoundException: Method not found: UserEditAction:a2s3g6b-z96rab-fb0tnazx-1-fb0treof-s.selectUser(be.post.jr.domain.UserProfile)
       at org.jboss.el.util.ReflectionUtil.findMethod(ReflectionUtil.java:215)
       at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:273)
       at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
       at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
       at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
       at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
       at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:174)
       at org.jboss.seam.navigation.Pages.callAction(Pages.java:634)
      


      Note in the stack trace, that some strange string has been added to the name of the method:
      UserEditAction:a2s3g6b-z96rab-fb0tnazx-1-fb0treof-s.selectUser(be.post.jr.domain.UserProfile)

      I must admit that I cannot find the cause by myself, even with comparing with the book (Yuan) and the examples.

      Does anybody have an idea for me ?
      Many thanks.

      John Rizzo.


      Environment:
      Facelets
      Seam 2.0.1.CR1.
      JBoss-4.2.2.GA