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



基本上,所有内容都在主题标题中表示。我需要实现的是,当我在向导的最后(确认)选项卡,并单击我的按钮,一切完成后,我想回到向导的第一个选项卡。当然,在此之后,向导中的所有内容都应该重置。


好吧,这没有帮助。现在我完全糊涂了。在点击按钮,我得到这个异常,但不是在服务器日志,只有在浏览器我得到:

An Error Occurred:

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"/>

有趣…

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

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

尝试使用p:wizardflowListener

<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";
}

相关内容

  • 没有找到相关文章

最新更新