这是我的流程(简化):
<view-state id="create" view="createCustomer.xhtml">
<transition on="create" to="end">
<evaluate expression="controller.validateCustomerFilled(customer)"/>
</transition>
</view-state>
<end-state id="end" view="customerCreated.xhtml">
<on-entry>
<evaluate expression="controller.createCustomer(customer)"/>
</on-entry>
</end-state>
和我的Facelet(也简化):
<p:commandButton value="Test Ajax" action="create" update="content, messages"/>
<p:commandButton value="Test No Ajax" action="create" ajax="false"/>
只要&#34; customerCreated.xhtml&#34;不包含h:表单,一切似乎都运行正常。但如果确实存在,则抛出以下异常:
java.lang.IllegalStateException: The current state 'end' of this flow 'customer/create' is not a view state - view scope not accessible
at org.springframework.webflow.engine.impl.FlowSessionImpl.getViewScope(FlowSessionImpl.java:119)
at org.springframework.webflow.engine.impl.RequestControlContextImpl.getViewScope(RequestControlContextImpl.java:130)
at org.springframework.faces.webflow.FlowResponseStateManager.saveState(FlowResponseStateManager.java:106)
at org.springframework.faces.webflow.FlowResponseStateManager.getViewState(FlowResponseStateManager.java:100)
at javax.faces.application.StateManager.getViewState(Unknown Source)
at javax.faces.application.StateManagerWrapper.getViewState(Unknown Source)
at com.sun.faces.context.PartialViewContextImpl.renderState(Unknown Source)
at com.sun.faces.context.PartialViewContextImpl.processPartial(Unknown Source)
at org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:60)
at javax.faces.context.PartialViewContextWrapper.processPartial(Unknown Source)
at javax.faces.component.UIViewRoot.encodeChildren(Unknown Source)
at javax.faces.component.UIComponent.encodeAll(Unknown Source)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(Unknown Source)
at com.sun.faces.application.view.MultiViewHandler.renderView(Unknown Source)
at javax.faces.application.ViewHandlerWrapper.renderView(Unknown Source)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(Unknown Source)
at com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
at com.sun.faces.lifecycle.LifecycleImpl.render(Unknown Source)
at org.springframework.faces.support.LifecycleWrapper.render(LifecycleWrapper.java:54)
at org.springframework.faces.webflow.JsfView.render(JsfView.java:87)
at org.springframework.webflow.action.ViewFactoryActionAdapter.doExecute(ViewFactoryActionAdapter.java:40)
at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
at org.springframework.webflow.engine.EndState.doEnter(EndState.java:100)
at org.springframework.webflow.engine.State.enter(State.java:194)
at org.springframework.webflow.engine.Transition.execute(Transition.java:228)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.execute(FlowExecutionImpl.java:395)
at org.springframework.webflow.engine.impl.RequestControlContextImpl.execute(RequestControlContextImpl.java:214)
at org.springframework.webflow.engine.TransitionableState.handleEvent(TransitionableState.java:116)
at org.springframework.webflow.engine.Flow.handleEvent(Flow.java:547)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.handleEvent(FlowExecutionImpl.java:390)
at org.springframework.webflow.engine.impl.RequestControlContextImpl.handleEvent(RequestControlContextImpl.java:210)
at org.springframework.webflow.engine.ViewState.handleEvent(ViewState.java:231)
at org.springframework.webflow.engine.ViewState.resume(ViewState.java:195)
at org.springframework.webflow.engine.Flow.resume(Flow.java:537)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:259)
at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:228)
at org.springframework.faces.webflow.JsfFlowHandlerAdapter.handle(JsfFlowHandlerAdapter.java:57)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1285)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:776)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:473)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1143)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:81)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:927)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:262)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:955)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
在没有Ajax的情况下使用常规h:commandButton时不会发生这种情况(使用f:ajax时,客户端没有任何反应)。
使用: - 春季4.2.0 - Spring Webflow 2.4.2 - Primefaces 5.2 - Mojarra 2.2.9
答案 0 :(得分:0)
你是一个明确表演的行动&#39;与controller.createCustomer(客户)
<end-state id="end" view="customerCreated.xhtml">
<on-entry>
<evaluate expression="controller.createCustomer(customer)"/>
</on-entry>
</end-state>
因此,这不是一个真正的终极状态。将其更改为操作状态,然后转换为空白/虚拟结束状态。