title: How to pass a parameter from JSP to Struts 2 action
body: <p>I have an application and I want to pass item <code>id</code> to the action every time the button for that item is pressed. </p>
  
  <h2>My JSP :</h2>
  
  <pre class="lang-jsp prettyprint-override"><code>&lt;s:submit  value="addToCart" action="addToCart" type="submit"&gt;
  &lt;s:param name="id" value="%{#cpu.id}" /&gt;
  &lt;/s:submit&gt;
  </code></pre>
  
  <h2>Action:</h2>
  
  <pre><code>public class ProductsCPU extends BaseAction implements Preparable, SessionAware {
  private static final long serialVersionUID = 2124421844550008773L;
  
  private List colors = new ArrayList&lt;&gt;();
  private List cpus;
  private String id;
  
  public String getId() {
      return id;
  }
  
  public void setId(String id) {
      this.id = id;
  }
  </code></pre>
  
  <p>When I print id to console, it has the <code>null</code> value. What is the problem?</p>