我認爲這很簡單,但我陷入了這個困境。這個想法是想使用liferay wizard
,如:https://www.primefaces.org/showcase/ui/panel/wizard.xhtml。我有這樣的XHTML:java.io.NotSerializableException:com.wings.marketingevent.util.FlowWizard
<h:form id="frmCreate">
<p:wizard flowListener="#{flowWizard.onFlowProcess}">
<p:tab id="header" title="Header">
<p:panel>
/*1*/
</p:panel>
</p:tab>
<p:tab id="detail" title="Detail">
<p:panel>
/*2*/
</p:panel>
</p:tab>
<p:tab id="confirmation" title="Confirmation">
<p:panel>
/*3*/
</p:panel>
</p:tab>
</p:wizard>
</h:form>
而且對bean:
@ManagedBean
@ViewScoped
public class FlowWizard {
public String onFlowProcess(FlowEvent event) {
return event.getNewStep();
}
}
但是,當我試圖點擊NEXT按鈕,它不會在頁面切換到下一個標籤,和我控制檯上出現以下錯誤消息:
11:16:21,663 ERROR [ExceptionHandlerAjaxImpl:62] java.io.NotSerializableException: com.wings.marketingevent.util.FlowWizard
javax.faces.FacesException: java.io.NotSerializableException: com.wings.marketingevent.util.FlowWizard
at com.sun.faces.renderkit.ResponseStateManagerImpl.getViewState(ResponseStateManagerImpl.java:137)
...
Caused by: java.io.NotSerializableException: com.wings.marketingevent.util.FlowWizard
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
...
Jul 13, 2013 11:16:21 AM org.apache.catalina.core.ApplicationDispatcher invoke
怎麼回事?謝謝。
什麼是bean的範圍,以實現
Serializable
? – Andy@安迪:它是'ViewScoped' .. –
CDI還是Managed?什麼是JSF版本呢?對不起,我無法複製你的錯誤。 – Andy