我有一个页面通过querystring接收一个id号码并显示相关文章。JSF 2.0查询字符串传播
我用<f:viewParams>
与preRenderView事件和数据从数据库中@PostConstruct方法加载:
@Named
@RequestScoped
public class Bean {
private Long id;
@PostCostruct
public void init() {
if (this.id != null) {
// load data from db
}
}
public String modify() {
// update data
}
}
当我调用数据被正确加载页面,但是当我点击修改按钮
<h:commandButton value="Modify" action="#{bean.modify}" />
我得到一个错误,因为没有查询字符串参数发送到bean,从而没有数据加载。
如何传播查询字符串参数?
但我需要在方法返回之前id参数,甚至在调用该方法,在init方法了。 – Alf 2011-01-29 21:33:19