Announcement Announcement Module
No announcement yet.
Using @Controller mixed with Web Flow Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using @Controller mixed with Web Flow

    I'm trying to use a mix of MVC and Web Flow, where some urls should map to a simple @Controller and some urls should map to a flow.

    When I only implement the MVC part, the pages show as expected.

    Then I add the flow part. Now the pages that are part of the flow show as expected, but the 'plain' pages do not show anymore! (404 errors, no mapping found)

    I know that because I added the flowadapter and flowmapping, the default adapter etc. that were previously automatically supplied by Spring are now overwritten by the flowbeans. So, I should add the adapter and mapping myself now.

    This is what I came up with, but the annotation mapping does not work.
    <beans xmlns=""
    	<context:annotation-config />
    	<context:component-scan base-package="xxx.web.controller" />
    <import resource="spring-webflow.xml" />
    	<!-- Enables annotated POJO @Controllers -->
    	<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
    	<!-- Enables plain Controllers -->
    	<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
    	<!-- Enables FlowHandlers -->
    	<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
    		<property name="flowExecutor" ref="flowExecutor"/>
    	<!-- URL to flow mapping rules -->			
    	<bean id="flowMappings" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    		<property name="mappings">
    		<property name="order" value="1"/>
    	<bean name="xxx"
    		class="xxx.web.webflow.xxxFlowHandler" />
    	<!-- Default mapping for Spring MVC -->
    		<property name="order" value="2" />
    	<bean id="viewResolver"
    		<property name="viewClass"
    		<property name="prefix" value="/WEB-INF/jsp/"></property>
    		<property name="suffix" value=".jsp"></property>
    public class HomeController {
    	@RequestMapping(value = "/home", method = RequestMethod.GET)
    	public ModelAndView home(HttpServletRequest request) {
     		return new ModelAndView("home");
    The web flow configuration is a standard one and works, so I left it out here.

    When I try to visit http://localhost/appname/secured/home, I get the '[PageNotFound] No mapping found for HTTP request with URI [/appname/secured/home] in DispatcherServlet' case.
    (As I mentioned before, visiting the above url works without the web flow beans.)

    What am I missing here?

    It seems like it is solved now. I'm not really sure what the real reason is, but I think it is the config file referenced by the dispatcherservlet in web.xml. As in the reference app, I removed this reference and put the lines in that file in the general configuration file.
    Last edited by CalamityAce; Jun 25th, 2009, 04:13 AM. Reason: Solved