Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: how can i start a web flow?

  1. #11
    Join Date
    Nov 2008
    Posts
    742

    Default

    The URL should be something like http://localhost:8080/appname/app/registration/

    The flowHandlerAdapter should be able to deal with this and start the flow, as mentioned in the SWF ref guide. Here's another entry dealing with the flow registry that might be useful.

    At this point, someone with experience using SWF with Spring MVC will probably be able to help you better. My SWF and Spring MVC config entries are slightly different, and may not be applicable to your app since I'm tying in with JSF.

  2. #12

    Default

    Ok, thanks for trying to help out. I appreciate it.

    /Kris

    Incidentally , this is the message I receive when I try to navigate to myAppName/registration:

    Code:
    org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/RekryteringsVerktyg/app/app/registration/] in DispatcherServlet with name 'Spring MVC Dispatcher Servlet'
    Last edited by Kristofer; Feb 18th, 2010 at 04:30 PM.

  3. #13
    Join Date
    Oct 2008
    Posts
    286

    Default

    Quote Originally Posted by InverseFalcon View Post
    You won't get many answers without providing more detail. For example, your webflow configuration files, the means you're using to try to start the flow, and what actually happened, including any helpful logging messages.
    Sorry Sir, I just really don't know what I need to post...
    Eros

    Environment:
    JSP 2.0
    Dojo 1.4.1
    Ext JS 3.1 (testing)
    Spring MVC 2.5.6.SEC01 (planning to Spring 3 using STS)
    STS
    SWF 2.0.9.RELEASE
    Tiles 2.0.5
    iBatis: ibatis-sqlmap-2.3.4.726

  4. #14
    Join Date
    Nov 2008
    Posts
    742

    Default

    Quote Originally Posted by eros View Post
    Sorry Sir, I just really don't know what I need to post...
    Look at Kristofer's posts as a guide. It sounds like you're making a jump from SWF 1 to SWF 2.

    It would be best to verify that you have SWF configured correctly, thus your config files (usually named webflow-config.xml and webmvc-config.xml) are a good place to start.

    Additionally, checking your mapping for the Spring Dispatcher in your web.xml file may help to determine what URL to use to invoke your flow.

    Likewise, knowing the name of your flow definition xml, and where it's located in your file structure, will also be helpful.

    Lastly, knowing what technologies you're using (JSF? Spring MVC?) in addition to SWF may help out too.

    The purpose here is just to ensure SWF is actually configured and working correctly. You should attempt to test this by entering the URL of your flow, which should kick it off and render the first view-state. Only after we can confirm the URL is working should we look at how to invoke it from any links or buttons.

  5. #15

    Default

    Code:
    <!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory -->
    	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    		<property name="prefix" value="/WEB-INF/views/"/>
    		<property name="suffix" value=".jsp"/>
    	</bean>
    I wonder if this could be causing trouble? the jsp:s associated with the webflow are located inside the WEB-INF/flows/registration. I thought the FlowHandlerMapping took care of this but maybe this isn't the case? My idea is that Spring goes through the different handlers in an orderly fashion, matching requests agains the appropriate handler:
    Code:
    <!-- Maps requests to flows in the flowRegistry -->
    	<bean id="flowMappings" class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
    		<property name="order" value="0" />
    		<property name="flowRegistry" ref="flowRegistry" />
    	</bean>
    	
    	<!-- Maps requests to @Controllers based on @RequestMapping("path") annotation values
    		 If no annotation-based path mapping is found, Spring MVC proceeds to the next HandlerMapping (order=2 below). -->
    	<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
    		<property name="order" value="1" />
    	</bean>
    	
    	<!-- Maps requests to @Controllers based on controller class name convention; e.g. a request for /hotels or a /hotels sub-resource maps to HotelsController
    	     If no class mapping is found, Spring MVC sends a 404 response and logs a pageNotFound warning. -->
    	<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
    		<property name="order" value="2" />
    	</bean>
    So that if a request for a flow comes in, the flowhandler takes over and handles it.

    webflow-config.xml:
    Code:
    	<!-- Configures the engine that executes web flows in this application -->
    	<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry" />
    
    	<!-- Registers the web flows that can be executed -->	
    	<webflow:flow-registry id="flowRegistry" base-path="/WEB-INF/flows" flow-builder-services="flowBuilderServices">
    		<!-- Register all flow definitions within the /WEB-INF/flows directory ending in "-flow.xml" -->
    		<webflow:flow-location-pattern value="/**/*-flow.xml" />
    	</webflow:flow-registry>
    
    	<!-- Configures settings used to build web flow definitions; development=true enables flow definition refresh on change -->
    	<webflow:flow-builder-services id="flowBuilderServices" development="true" />

  6. #16
    Join Date
    Nov 2008
    Posts
    742

    Default

    That's a possibility. However, you would likely get a message for that once the view attempts rendering. I don't think your flow is even being executed yet, so you should try to tackle that issue first.

    The message you posted earlier seems to have an extra "app" in the URL. Don't know how that's getting in there...

  7. #17

    Default

    Whenever you create a new Spring MVC Sample Project in STS it automatically adds functionality to make url:s more "friendly" looking. I think that's what making those extra /app/.

    urlrewrite.xml:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN" "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
    <urlrewrite default-match-type="wildcard">
    	<rule>
    		<from>/</from>
    		<to>/app/welcome</to>
    	</rule>
    	<rule>
    		<from>/**</from>
    		<to>/app/$1</to>
    	</rule>
    	<outbound-rule>
    		<from>/app/**</from>
    		<to>/$1</to>
    	</outbound-rule>	
    </urlrewrite>
    I've tried adding a controller to trigger the flow but that doesn't seem to work:

    Code:
    @Controller
    public class WebflowController {
    	
    	@RequestMapping("/startflow")
    	public String registrationHandler() {
    		return "/registration";
    	}
    }
    Heh, I'm starting to wonder if webflow is even compatible with Spring 3.0.

  8. #18
    Join Date
    Nov 2008
    Posts
    742

    Default

    Didn't realize you were using Spring 3.

    I know SWF 2 wasn't designed with Spring 3 in mind, and vice versa, though some people have had some success on some levels. SWF 3 will likely have full support for Spring 3 compatibility.

  9. #19

    Default

    Quote Originally Posted by InverseFalcon View Post
    Didn't realize you were using Spring 3.

    I know SWF 2 wasn't designed with Spring 3 in mind, and vice versa, though some people have had some success on some levels. SWF 3 will likely have full support for Spring 3 compatibility.
    It would be strange if Spring 3 didn't support SWF2, seeing as there really isn't any good mechanism/method in place for moving between spring forms, in a wizard-like way, without that support.

  10. #20
    Join Date
    Nov 2008
    Posts
    742

    Default

    Like I said, it kinda supports it. I know there have been conflicts between certain classes/packages between SWF 2 and Spring 3 (see this thread for more).

    SWF 3 is under development, and one of its tasks is to fully integrate with Spring 3 (see the JIRA for milestone 1).

    If I'm reading it correctly, M1 release is this coming Wednesday.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •