我有一个 jsf 页面。我想在每次刷新页面时重新加载页面
我试过这段代码,但它不工作
public String onload() {
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
String id = viewRoot.getViewId();
if(previousPage!=null && previousPage.equals(id)){
return "brcmBuildSheet?faces-redirect=true";
}
previousPage = id;
return "";
}
所以我决定用数字来表示它是否已经加载。
public String onload() {
if (previousViewID !=nextViewID ){
nextViewID=0;
System.out.println("reload");
return "brcmBuildSheet?faces-redirect=true"; //brcmBuildSheet?faces-redirect=true
}
++nextViewID;
System.out.println("first page");
return "First page, but increment value for reload";
}
这是我的 jsf 页面
<f:metadata>
<f:viewParam name="foo" value="#{bean.foo}" />
<f:viewAction action="#{buildsheetController.onload}" />
</f:metadata>
我收到了这个错误
JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash. Any values stored to the flash will not be available on the next request.
更新:当我将第二个返回值设置为 null 时,它给了我这个错误
2018-07-30T14:57:52.975+0800|Severe: JSF1094: Could not decode flash data from incoming cookie value Invalid characters in decrypted value. Processing will continue, but the flash is unavailable for this request.