确认后,导航到向导的第一个选项卡

时间:2011-09-02 11:43:08

标签: jsf primefaces

相当多,一切都在主题标题中说。我需要实现的是当我在向导的最后一个(确认)标签中并点击我的按钮时,一切都完成后,我想回到第一个标签向导当然,之后应该重置向导中的所有内容。


嗯,没有用。目前我完全糊涂了。点击按钮我得到这个例外,但不是在服务器日志中,只在我得到的浏览器中:

发生错误:

显示java.lang.NullPointerException

java.lang.NullPointerException
at org.primefaces.component.datatable.DataHelper.decodeFilters(DataHelper.java:167)
at org.primefaces.component.datatable.DataTableRenderer.decode(DataTableRenderer.java:51)
at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:790)
at javax.faces.component.UIData.processDecodes(UIData.java:980)
at org.primefaces.component.datatable.DataTable.processDecodes(DataTable.java:542)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at org.primefaces.component.panel.Panel.processDecodes(Panel.java:282)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at org.primefaces.component.wizard.Wizard.processDecodes(Wizard.java:210)
at javax.faces.component.UIForm.processDecodes(UIForm.java:216)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:941)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)

按钮看起来像这样:

<p:commandButton ajax="false" value="Save service" action="#{kuBean.saveService}"
                                         update="growl"/>

2 个答案:

答案 0 :(得分:0)

...有趣

假设你的bean是@ViewScoped,那么一个简单的页面重定向到你的向导页面的url应该重新实现你的向导托管bean。如果这不起作用,您可以将GET属性[url]?faces-redirect=true附加到URL。

如果您的托管bean是@SessionScoped,这将不起作用,因为来自先前向导确认的数据和状态信息可能仍然存在。最好的解决方案是切换到ViewScoped,如果不可能,那么编写一个可以清除托管bean的状态和数据的托管bean的重置方法。

答案 1 :(得分:0)

尝试使用 p:wizard flowListener

<p:wizard flowListener="#{userWizard.handleFlow}">
...
</p:wizard>
你的bean中的

public String handleFlow(FlowEvent event) {
   String currentStepId = event.getCurrentStep();
   String stepToGo = event.getNextStep();
   //if(skip)
   //return "confirm";
   //else
   //return event.getNextStep();

   ... portion where you are to return to the first tab
   return "id_value_of_first_tab";
}