title: Command button with EL method argument does not invoke action method
body: <p>I am trying to delete a database entry by sending the primary key "userId" as EL method argument via a command button to my managed bean.</p>
  
  <p>My current code looks like</p>
  
  <p>Bean:</p>
  
  <pre><code>@ManagedBean
  @RequestScoped
  public class HibernateUserHandling 
  {
  ...
  public void deleteUser(String userIdViaXhtml)
  {
      Session session = sessionFactory.openSession();
      session.beginTransaction();
  
      session.createQuery("DELETE FROM AddressDetails WHERE USERID = :userIdViaXhtml");
      session.createQuery("DELETE FROM UserDetails WHERE USERID = :userIdViaXhtml");
  
      session.getTransaction().commit();
      session.close();
  }
  ...
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>    &lt;html&gt;
      &lt;body&gt;
          &lt;ui:composition template="./generalTemplate.xhtml"
          xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:ui="http://java.sun.com/jsf/facelets"&gt;
          &lt;ui:define name="content"&gt;
              &lt;h:outputStylesheet library="css" name="cssHibernate.css" /&gt;
                  &lt;h:form id="main"&gt;
                      &lt;h:dataTable value="#{hibernateDataOutput.persons}" var="list"
                                  styleClass="order-table"
                                  headerClass="order-table-header"
                                  rowClasses="order-table-odd-row,order-table-even-row"&gt;
                          ...
                              &lt;f:facet name="header"&gt;Delete&lt;/f:facet&gt;
                              &lt;h:commandButton id="userId" action="#{hibernateUserHandling['deleteUser(list.userId)']}" image="delete.jpg" /&gt;
                          &lt;/h:column&gt;
                      &lt;/h:dataTable&gt;
                      ...
                  &lt;/h:form&gt;
              &lt;/ui:define&gt;
          &lt;/ui:composition&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I tested more ways, e.g. via getting the value to a seperate variable in the bean like in a inputText, but nothing worked.</p>
  
  <p>I think I got a totally wrong basic approach.</p>
  
  <p>I get the following error:</p>
  
  <pre><code>/hibernate.xhtml @39,137 action="#{hibernateUserHandling.deleteUser(list.userId)}" Failed to parse the expression [#{hibernateUserHandling.deleteUser(list.userId)}]
  </code></pre>
  
  <p>Stack trace:</p>
  
  <pre><code>    javax.faces.view.facelets.TagAttributeException: /hibernate.xhtml @39,137 action="#{hibernateUserHandling.deleteUser(list.userId)}" Failed to parse the expression [#{hibernateUserHandling.deleteUser(list.userId)}]
              at com.sun.faces.facelets.tag.TagAttributeImpl.getMethodExpression(TagAttributeImpl.java:232)
              at com.sun.faces.facelets.tag.jsf.ActionSourceRule$ActionMapper2.applyMetadata(ActionSourceRule.java:104)
              at com.sun.faces.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:81)
              at javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:129)
              at javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:102)
              at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.doNewComponentActions(ComponentTagHandlerDelegateImpl.java:402)
              at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:159)
              at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
              at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
              at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
              at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)
              at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
              at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
              at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
              at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)
              at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
              at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
              at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
              at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)
              at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
              at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
              at com.sun.faces.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:103)
              at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:178)
              at com.sun.faces.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:395)
              at com.sun.faces.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:366)
              at com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:108)
              at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
              at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)
              at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
              at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
              at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
              at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)
              at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
              at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
              at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
              at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
              at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
              at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
              at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
              at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)
              at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
              at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155)
              at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
              at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
              at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
              at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:769)
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:410)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
              at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
              at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)
              at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.el.ELException: Failed to parse the expression [#{hibernateUserHandling.deleteUser(list.userId)}]
              at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:146)
              at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:172)
              at org.apache.el.lang.ExpressionBuilder.createMethodExpression(ExpressionBuilder.java:223)
              at org.apache.el.ExpressionFactoryImpl.createMethodExpression(ExpressionFactoryImpl.java:57)
              at com.sun.faces.facelets.tag.TagAttributeImpl.getMethodExpression(TagAttributeImpl.java:222)
              ... 61 more
      Caused by: org.apache.el.parser.ParseException: Encountered " "(" "( "" at line 1, column 35.
      Was expecting one of:
          "}" ...
          "." ...
          "[" ...
          "&gt;" ...
          "gt" ...
          "&lt;" ...
          "lt" ...
          "&gt;=" ...
          "ge" ...
          "&lt;=" ...
          "le" ...
          "==" ...
          "eq" ...
          "!=" ...
          "ne" ...
          "&amp;&amp;" ...
          "and" ...
          "||" ...
          "or" ...
          "*" ...
          "+" ...
          "-" ...
          "/" ...
          "div" ...
          "%" ...
          "mod" ...
  
              at org.apache.el.parser.ELParser.generateParseException(ELParser.java:2142)
              at org.apache.el.parser.ELParser.jj_consume_token(ELParser.java:2024)
              at org.apache.el.parser.ELParser.DeferredExpression(ELParser.java:113)
              at org.apache.el.parser.ELParser.CompositeExpression(ELParser.java:40)
              at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:114)
              ... 65 more
  </code></pre>