我需要避免在刷新時發生雙重POST。所以我使用POST/Redirect/GET模式(faces-redirect=true
)和導航處理程序(通過@BalusC),如this post。如何在JSF 2.0中使用該模式時,操作方法返回null
(留在同一頁面上)?它甚至有可能,或者我需要使用其他POST/Redirect/GET?我需要保持活動視圖範圍的bean,所以在操作方法中返回相同的視圖(PRG工作)不是解決方案(導致丟失view scope
)。當操作方法返回null(留在同一頁)時,JSF 2.0:POST/Redirect/GET模式
視圖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
}
}
嗨,你可以舉一個你正在試圖解決的使用案例嗎? –
你有沒有想過這個? – edhedges