Jsf 闪存范围警告和闪存重定向后不删除
我试图在使用JSF和Primefaces在View1到View2之间重定向时传递一个对象 我正在使用JSF Flash scope来执行此操作,对象确实会传递到第二个视图,但我仍然收到以下警告: com.sun.faces.context.flash.ELFlash setCookie 警告:JSF1095:在我们尝试为闪存设置传出cookie时,响应已经提交。下次请求时,存储到闪存的任何值都将不可用 即使再重定向几次,flash cookie也不会被删除 View1.xhtmlJsf 闪存范围警告和闪存重定向后不删除,jsf,jsf-2,primefaces,flash-scope,Jsf,Jsf 2,Primefaces,Flash Scope,我试图在使用JSF和Primefaces在View1到View2之间重定向时传递一个对象 我正在使用JSF Flash scope来执行此操作,对象确实会传递到第二个视图,但我仍然收到以下警告: com.sun.faces.context.flash.ELFlash setCookie 警告:JSF1095:在我们尝试为闪存设置传出cookie时,响应已经提交。下次请求时,存储到闪存的任何值都将不可用 即使再重定向几次,flash cookie也不会被删除 View1.xhtml <ui:
<ui:composition xmlns=...... template="../../../BaseTemplate.xhtml">
<ui:define name="templateContent">
<mm:MyComponent />
</ui:define>
</ui:composition>
<html xmlns= ......>
<composite:interface componentType="usersListComponent">
</composite:interface>
<composite:implementation>
<h:form>
<p:commandButton action="#{cc.passObject}" value="passMyObject" />
</h:form>
</composite:implementation>
</html>
View2Controller.java
@FacesComponent("myComponent")
public class MyComponent extends UIComponentBase {
private MyObject objectToPass;
public String passObject() {
ExternalContext externalContext= FacesContext.getCurrentInstance().getExternalContext();
externalContext.getFlash().put("objectToPass", objectToPass);
return "View2";
}
}
@ManagedBean
@ViewScoped
public class View2Controller implements Serializable {
@PostConstruct
public void init() {
MyObject ob = (MyObject) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("objectToPass");
......Do Something with MyObject
}
}
解决了强>
我不确定这是不是最好的办法,但对我来说很有效
问题在于http缓冲区大小和jsf生命周期,Cookie是在写入响应后写入的,缓冲区太小,无法同时容纳它们。我不确定这是最好的方法,但它对我来说很有效
问题在于http缓冲区大小和jsf生命周期,Cookie是在写入响应后写入的,缓冲区太小,无法同时包含它们。哪个jsf impl/version?jsf api:2.2.13 jsf impl:2.2.13