编程语言
首页 > 编程语言> > java – Spring MVC – Web Flow Controller

java – Spring MVC – Web Flow Controller

作者:互联网

我有一个使用spring框架和spring webflow开发的j2ee应用程序.目前,我的所有网址请求都通过网络流量传输.我想要的是能够选择是将它引导到Web Flow还是普通的spring mvc控制器.我不知道如何将它指向自定义控制器.我该怎么做呢?

我尝试在我的web.xml中使用它,但我不能将它指向mytest2-servlet.xml中指定的bean控制器

<servlet>
    <servlet-name>mytest</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value></param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>

<servlet>
    <servlet-name>mytest2</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <init-param>
        <param-name>contextConfigLocation2</param-name>
        <param-value></param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>


<servlet-mapping>
    <servlet-name>mytest</servlet-name>
    <url-pattern>*.do</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>mytest2</servlet-name>
    <url-pattern>*.htm</url-pattern>
</servlet-mapping>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/web-application-config.xml
</param-value>
</context-param>

<context-param>
    <param-name>contextConfigLocation2</param-name>
    <param-value>
        /WEB-INF/mytest2-servlet.xml
</param-value>
</context-param>

解决方法:

在最终状态下尝试这个

<end-state id="exit" view="externalRedirect:controllerURL" />

其中’controllerURL’是控制器监听的URL /

标签:java,spring-mvc,spring,java-ee,spring-webflow
来源: https://codeday.me/bug/20190705/1385510.html