I'm going to pass a parameter from one page (Facelet) to a Managed Bean whose scope is View Scope.
I try to do it like this:
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;
}
}
First page:
<h:body>
<h:form>
<h:commandLink value="click" action="index">
<f:setPropertyActionListener target="#{mybean.id}" value="20"/>
</h:commandLink>
</h:form>
</h:body>
second page:
<h:body>
param value #{param.id}
<br />
bean value #{mybean.id}
<br />
<h:messages/>
</h:body>
But it does not show 20