title: Pass Parameter to ViewScoped Bean
body: <p>I'm going to pass a parameter from one page (Facelet) to a Managed Bean whose scope is View Scope.</p>
  
  <p>I try to do it like this:</p>
  
  <pre><code>import javax.faces.bean.ManagedBean;
  import javax.faces.bean.ViewScoped;
  
  @ManagedBean
  @ViewScoped
  public class Mybean {
    private int id;
  
  
    public int getId() {
      return id;
    }
  
    public void setId(int id) {
      this.id = id;
    }    
  }
  </code></pre>
  
  <p>First page: </p>
  
  <pre><code>  &lt;h:body&gt;            
      &lt;h:form&gt;
        &lt;h:commandLink value="click" action="index"&gt;
          &lt;f:setPropertyActionListener target="#{mybean.id}" value="20"/&gt;
        &lt;/h:commandLink&gt;
      &lt;/h:form&gt;
    &lt;/h:body&gt;
  </code></pre>
  
  <p>second page:</p>
  
  <pre><code>  &lt;h:body&gt;
      param value #{param.id}
      &lt;br /&gt;
      bean value #{mybean.id}
      &lt;br /&gt;
  
      &lt;h:messages/&gt;
    &lt;/h:body&gt;
  </code></pre>
  
  <p><strong>But it does not show 20</strong></p>