[英]Dispatching from Spring MVC to Spring Webflow
My application is about 80% Spring MVC, but I have a fair amount of code that uses Webflow. 我的应用程序大约是80%的Spring MVC,但是我有大量使用Webflow的代码。 I'm currently using a Spring MVC SimpleUrlHandlerMapping to dispatch to the webflow, which I know isn't how I'm "supposed" to do it. 我目前正在使用Spring MVC SimpleUrlHandlerMapping调度到Webflow,我知道这不是我“应该”做到的。
My flow definitions are defined as follows: 我的流程定义定义如下:
I want to be able to access them via the following URLS: 我希望能够通过以下URL访问它们:
My flow registry bean looks like this: 我的流注册表bean看起来像这样:
<webflow:flow-registry id="flowRegistry" base-path="WEB-INF/flows" flow-builder-services="flowBuilderServices" >
<webflow:flow-location-pattern value="/**/*/*-flow.xml"/>
</webflow:flow-registry>
My javascript to dispatch to the webflow looks like this (javascript snippet, it's a very complex page): 我的要分派到Webflow的javascript看起来像这样(javascript片段,这是一个非常复杂的页面):
var form = $('<form action="${pageContext.request.contextPath}/process1/reservation/reservation.html" method="POST">');
form.append('<input name="param1" value="' + record.param1 + '" />');
form.append('<input name="param2" value="' + record.param2 + '" />');
form.append('</form>');
submitForm(form);
Now for the real question: How do I set up a url handler mapping for it, whether it be SimpleUrlHandlerMapping
or something else? 现在是一个真正的问题:如何为它设置url处理程序映射,无论是SimpleUrlHandlerMapping
还是其他?
Thanks! 谢谢!
Usually if you want to dispatch request to web-flow through Spring-MVC, we have to set up FlowHandlerAdapter like: 通常,如果您想通过Spring-MVC将请求分派到Web流,我们必须像下面这样设置FlowHandlerAdapter:
<!-- Enables FlowHandler URL mapping -->
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
And then define flowMapping: 然后定义flowMapping:
<!-- Maps request paths to flows in the flowRegistry;
e.g. a path of /movie/showtime looks for a flow with id "movie/showtime" -->
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry"/>
<property name="order" value="0"/>
</bean>
For detail implementation, you can also refer to spring docs. 有关详细的实现,您还可以参考spring文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.