【发布时间】:2011-08-09 06:04:29
【问题描述】:
我需要避免在刷新时重复 POST。所以我使用POST/Redirect/GET 模式(faces-redirect=true)和导航处理程序(@BalusC),就像this post 一样。当操作方法返回null(保持在同一页面上)时,如何在 JSF 2.0 中使用该模式?甚至有可能还是我需要使用 POST/Redirect/GET 以外的东西?我需要让视图范围的 bean 保持活动状态,因此在操作方法中返回相同的视图(PRG 有效)不是解决方案(导致丢失 view scope)。
查看 test.xhtml:
<h:commandButton action="#{bean.send}"/>
豆子:
@ManagedBean
@ViewScoped
class Bean {
String send() {
// do something...
return null;
}
String send2() {
// do something...
return "test"; // view scope lost
}
}
【问题讨论】:
-
您好,您能否举例说明您尝试解决的使用案例?
-
你有没有想过这个问题?
标签: jsf-2