title: Passing parameter to JSF action
body: <p>I'm using GlassFish 3.1, and trying to pass parameter to commandButton action. Following is my code:</p>
  
  <p><strong>beans.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd" /&gt;
  </code></pre>
  
  <p><strong>faces-config.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" /&gt;
  </code></pre>
  
  <p><strong>ManagedBean class</strong></p>
  
  <pre><code>package actionParam;
  
  import javax.enterprise.context.RequestScoped;
  import javax.inject.Named;
  
  @Named("bean")
  @RequestScoped
  public class ActionParam {
  
      public ActionParam() {
          super();
      }
  
      public String submit(int param) {
          System.out.println("Submit using value " + param);
          return null;
      }
  
  }
  </code></pre>
  
  <p>and finally,</p>
  
  <p><strong>View</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"&gt;
  &lt;h:head&gt;
      &lt;meta http-equiv="Content-Type"
          content="text/html; charset=ISO-8859-1" /&gt;
      &lt;title&gt;Test Action Param&lt;/title&gt;
  &lt;/h:head&gt;
  &lt;h:body&gt;
      &lt;h:form id="actionForm"&gt;
          &lt;h:commandButton id="actionButton" value="Submit"
              action="#{bean.submit}"&gt;
              &lt;f:param name="param" value="123"&gt;&lt;/f:param&gt;
          &lt;/h:commandButton&gt;
      &lt;/h:form&gt;
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I click submit button, I get <strong>javax.el.MethodNotFoundException</strong>.</p>
  
  <p>If I remove <code>&lt;f:param ... /&gt;</code> and pass parameter as follows,</p>
  
  <pre><code>.
  :
          &lt;h:commandButton id="actionButton" value="Submit"
              action="#{bean.submit(123)}"&gt;
          &lt;/h:commandButton&gt;
  :
  .
  </code></pre>
  
  <p>it works OK.</p>
  
  <p>But I was thinking first way (using f:param) is correct one.</p>
  
  <p>Which is the correct way to pass parameter?</p>
  
  <p>Thanks in advance.</p>