Announcement Announcement Module
Collapse
No announcement yet.
The basic web flow does not work Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • The basic web flow does not work

    I have been trying for 3 days now to get a web flow to work. I am down to a single transition that does not work and my frustration is reaching a Postal Service level.

    Here is my setup...

    I am running
    Spring 3.0.0.RELEASE
    WebFlow 2.0.9.RELEASE
    Tomcat 6.0.26
    Fedora 11

    Here is my Spring configuration file :

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <beans xmlns="http://www.springframework.org/schema/beans"
    	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	   xmlns:mvc="http://www.springframework.org/schema/mvc"
    	   xmlns:context="http://www.springframework.org/schema/context"
           xmlns:webflow="http://www.springframework.org/schema/webflow-config"
    	   xsi:schemaLocation="
                http://www.springframework.org/schema/beans	          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/mvc             http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
                http://www.springframework.org/schema/context         http://www.springframework.org/schema/context/spring-context-3.0.xsd
                http://www.springframework.org/schema/webflow-config  http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd
            ">
    
    	<!-- Scans the classpath of this application for @Components to deploy as beans -->
    	<context:component-scan base-package="net.kb" />
    
    	<!-- Configures the @Controller programming model -->
    	<mvc:annotation-driven />
    
        <!-- Allows for the @RequestMapping at the class level. -->
        <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
    
        <!-- Allows for the @RequestMapping at the method level. -->
        <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
    
    	<!-- 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/jsp/"/>
    		<property name="suffix" value=".jsp"/>
    	</bean>
        -->
    
        <!-- WebFlow stuff -->
        <bean id="webflowUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <value>
                    /testFlowBasic.php=flowHandler
                </value>
            </property>
        </bean>
    
        <bean id="flowHandler" class="org.springframework.webflow.mvc.servlet.AbstractFlowHandler"/>
    
        <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
            <property name="flowExecutor" ref="flowExecutor"/>
        </bean>
    
        <webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry"/>
    
        <webflow:flow-registry id="flowRegistry">
            <webflow:flow-location path="/WEB-INF/jsp/testFlowBasic.xml"/>
        </webflow:flow-registry>
    
    
    </beans>

    Here is my webflow configuration file :

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <flow   xmlns="http://www.springframework.org/schema/webflow"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.springframework.org/schema/webflow
                                http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
    
      <global-transitions>
        <transition on="Cancel" to="cancelPage" />
      </global-transitions>
    
    
      <view-state id="basicFlowStep1" view="basicFlowStep1.jsp">
        <transition on="Next" to="summaryPage" />
      </view-state>
    
      <view-state id="cancelPage" view="flow01cancel.jsp" />
    
      <end-state id="summaryPage" view="endflow01.jsp" />
    
    </flow>
    Here is the error I get when I try to hit the webflow :

    Code:
    org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content starting with element 'view-state'. The content must match '(("http://www.springframework.org/schema/webflow":attribute){0-UNBOUNDED},("http://www.springframework.org/schema/webflow":secured){0-1},("http://www.springframework.org/schema/webflow":persistence-context){0-1},("http://www.springframework.org/schema/webflow":var){0-UNBOUNDED},("http://www.springframework.org/schema/webflow":input){0-UNBOUNDED},("http://www.springframework.org/schema/webflow":on-start){0-1},(("http://www.springframework.org/schema/webflow":action-state)|("http://www.springframework.org/schema/webflow":view-state)|("http://www.springframework.org/schema/webflow":decision-state)|("http://www.springframework.org/schema/webflow":subflow-state)|("http://www.springframework.org/schema/webflow":end-state)){0-UNBOUNDED},("http://www.springframework.org/schema/webflow":global-transitions){0-1},("http://www.springframework.org/schema/webflow":on-end){0-1},("http://www.springframework.org/schema/webflow":output){0-UNBOUNDED},("http://www.springframework.org/schema/webflow":exception-handler){0-UNBOUNDED},("http://www.springframework.org/schema/webflow":bean-import){0-UNBOUNDED})'.
    	org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    	org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    	javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
    	org.springframework.webflow.engine.model.builder.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:113)
    	org.springframework.webflow.engine.model.builder.xml.XmlFlowModelBuilder.init(XmlFlowModelBuilder.java:113)
    	org.springframework.webflow.engine.model.builder.DefaultFlowModelHolder.assembleFlowModel(DefaultFlowModelHolder.java:87)
    	org.springframework.webflow.engine.model.builder.DefaultFlowModelHolder.getFlowModel(DefaultFlowModelHolder.java:61)
    	org.springframework.webflow.engine.builder.model.FlowModelFlowBuilder.doInit(FlowModelFlowBuilder.java:147)
    	org.springframework.webflow.engine.builder.support.AbstractFlowBuilder.init(AbstractFlowBuilder.java:46)
    	org.springframework.webflow.engine.builder.FlowAssembler.assembleFlow(FlowAssembler.java:90)
    	org.springframework.webflow.engine.builder.DefaultFlowHolder.assembleFlow(DefaultFlowHolder.java:109)
    	org.springframework.webflow.engine.builder.DefaultFlowHolder.getFlowDefinition(DefaultFlowHolder.java:84)
    	org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl.getFlowDefinition(FlowDefinitionRegistryImpl.java:61)
    	org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:138)
    	org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)
    	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
    	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
    	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    I have reduced my view-state tag to its bare minimum and still the SAX parser complains that my view-state does not parse. I am at the end of my rope. Can somebody offer some good advice on how to get this mess working?

  • #2
    Well read the stacktrace... The ordering of the elements is wrong.

    Global transitions should be at the end of the xml not at the start.

    Comment


    • #3
      Thank you for your response, Marten. I don't see any mention in the stack trace that the tags are ordered incorrectly, but I believe you and I will give that a try.

      On reviewing the Schema for webflow I see that the global-transitions tag does come after the view-state tag, but the error message seemed to be saying that there was a problem with parsing the view-state tag.

      Yours,

      Clark

      Time passes...

      Yes, you are correct once again, Marten. I had some other minor issues, but you got me past my hurdle. The Spring folks should really call this WebFlow forum the Marten Deinum forum. You do have the answers.
      Last edited by clark; May 11th, 2010, 01:30 PM. Reason: followup

      Comment

      Working...
      X