Spring MVC - Web Flow Controller

cedric picture cedric · Jan 21, 2010 · Viewed 8.6k times · Source

I have a j2ee application developed using spring framework and spring webflow. Currently all of my url requests go through the Web Flow. What I want is to be able to choose whether to direct it to Web Flow or an ordinary spring mvc controller. I have no idea how to direct it to custom controllers. How do I do this?

I tried having this in my web.xml but i can't direct it to the bean controller specified in mytest2-servlet.xml

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

Answer

Alan Robles picture Alan Robles · Jun 22, 2012

Try this in your end state

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

where 'controllerURL' is the URL that your controller listens to/