【发布时间】:2011-06-02 19:24:05
【问题描述】:
我将把一个页面(Facelet)中的参数传递给一个作用域为 View Scope 的托管 Bean。
我尝试这样做:
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;
}
}
首页:
<h:body>
<h:form>
<h:commandLink value="click" action="index">
<f:setPropertyActionListener target="#{mybean.id}" value="20"/>
</h:commandLink>
</h:form>
</h:body>
第二页:
<h:body>
param value #{param.id}
<br />
bean value #{mybean.id}
<br />
<h:messages/>
</h:body>
但它没有显示 20
【问题讨论】: