Announcement Announcement Module
Collapse
No announcement yet.
WebFlow-Urgent help Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • WebFlow-Urgent help

    I am using Spring Webflow 1.0 version.

    Present application Using REST style flows.Below is the code:
    From login.jsp
    Code:
    <a href="<c:url value="/flows/passwordReset"/>"><fmt:message key="login.passwordResetLink"/></a>
    flows.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:flow="http://www.springframework.org/schema/webflow-config"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
            http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd
            ">
    
        <!-- ====================== GENERAL DEFINITIONS ====================== -->
    
        <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="alwaysUseFullPath" value="true"/>
           <!--  <property name="mappings" 
           value="/flows/**/**=flowController"> -->
           <property name="mappings">
               <props>
    				<prop key="/flows/**/**">flowController</prop>
    			</props>
            </property>
        </bean>
    
        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="prefix" value="/WEB-INF/jsp/"/>
            <property name="suffix" value=".jsp"/>
        </bean>
    
        <flow:executor id="flowExecutor" registry-ref="flowRegistry">
            <flow:execution-listeners>
                <flow:listener ref="remoteAddressFlowExecutionListener"/>
            </flow:execution-listeners>
        </flow:executor>
    
        <flow:registry id="flowRegistry">
            <flow:location path="/WEB-INF/flows/*.xml"/>
        </flow:registry>
    
        <bean id="exceptionResolver"
            class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
            <property name="exceptionMappings">
                <props>
                    <prop key="org.springframework.webflow.execution.repository.NoSuchFlowExecutionException">redirect:/</prop>
                </props>
            </property>
        </bean>
    
    
        <!-- ==================== CONTROLLER DEFINITIONS ===================== -->
    
        <bean id="flowController"
            class="org.springframework.webflow.executor.mvc.FlowController">
            <property name="argumentHandler">
                <bean class="org.springframework.webflow.executor.support.RequestParameterFlowExecutorArgumentHandler"/>
                
            </property>
            <property name="flowExecutor" ref="flowExecutor"/>
        </bean>
    
    
        <!-- ======================= FORM DEFINITIONS ======================== -->
    
        <bean id="passwordResetFormAction"
            class="org.springframework.webflow.action.FormAction">
            <property name="formObjectClass" value="com.esha.edt.model.PasswordReset"/>
            <property name="formObjectName" value="passwordReset"/>
            <property name="validator">
                <bean class="com.test.edt.web.PasswordResetValidator">
                    <property name="accountManager" ref="accountManager"/>
                    <property name="passwordResetManager" ref="passwordResetManager"/>
                </bean>
            </property>
        </bean>
    
    
        <!-- ===================== LISTENER DEFINITIONS ====================== -->
    
        <bean id="remoteAddressFlowExecutionListener"
            class="com.test.edt.web.RemoteAddressFlowExecutionListener"/>
    
    </beans>
    passWordReset.xml
    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-1.0.xsd
            ">
    
        <start-actions>
            <action bean="passwordResetFormAction" method="setupForm"/>
        </start-actions>
    
        <start-state idref="enterUsername"/>
    
        <view-state id="enterUsername" view="passwordReset/usernameForm">
        
            <transition on="cancel" to="finish"/>
            
            <transition on="submit"  to="startReset">
                <action bean="passwordResetFormAction"  method="bindAndValidate">
                    <attribute name="validatorMethod" value="validateUsername"/>
                </action>
            </transition>
        </view-state>
    
        <action-state id="startReset">
        
            <bean-action bean="passwordResetManager" method="startReset">
                <method-arguments>
                    <argument  expression="requestScope.remoteAddress"/>
                    <argument expression="requestScope.flowExecutionKey"/>   
                    <argument expression="flowScope.passwordReset"/>
                </method-arguments>
            </bean-action>
            <transition on="success" to="enterResetCode"/>
        </action-state>
    
        <view-state id="enterResetCode" view="passwordReset/resetCodeForm">
            <transition on="cancel" to="finish"/>
            <transition on="submit" to="enterNewPassword">
                <action bean="passwordResetFormAction" method="bindAndValidate">
                    <attribute name="validatorMethod" value="validateResetCode"/>
                </action>
            </transition>
        </view-state>
    
        <view-state id="enterNewPassword" view="passwordReset/passwordForm">
            <transition on="cancel" to="finish"/>
            <transition on="submit" to="endReset">
                <action bean="passwordResetFormAction" method="bindAndValidate"/>
            </transition>
        </view-state>
    
        <action-state id="endReset">
            <bean-action bean="passwordResetManager" method="endReset">
                <method-arguments>
                    <argument expression="requestScope.remoteAddress"/>
                    <argument expression="flowScope.passwordReset"/>
                </method-arguments>
            </bean-action>
            <transition on="success" to="displayStatus"/>
        </action-state>
    
        <view-state id="displayStatus" view="passwordReset/displayStatus">
            <transition on="submit" to="finish"/>
        </view-state>
    
        <end-state id="finish" view="externalRedirect:/"/>
    
    </flow>
    My Problems:

    1) I need a flowExecutionKey before startReset(refer above xml file) method called.After debugging the code of "RequestParameterFlowExecutorArgumentHandler.java" (From spring package),this class preparing the flowExecutionKey after "startReset" method is finished.

    PLease help me this is very urgent issue.Need inputs from experts in spring webflow.

    Thanks ,
    RK

  • #2
    Any Help Please?

    Comment


    • #3
      Why do you need the flowExecutionKey? Its not recommended to use that key..its something spring web flow generates dynamically with each request.

      Comment


      • #4
        Hi Mahesh,

        Thanks,I have two pages(Steps),In first screen i am entering my user id.So it geneares the mail with code.What my requirement is i need entire url in my mail ,once i click that link it should go to that page and populate the same.

        That is the case i need flowExecutonKey to go to that particular page.Now what happens is after clicking the submit button in first page,it generates mail and finally navigates to second page(that is the reason i was not able to pickup the flowExecutionKey).PLease see the above code.

        I think you got my question?

        Thanks,
        RK

        Comment


        • #5
          With web flow you cant go into the middle of the flow..and if you just have a couple of pages to handle..i suggest using plain MVC.

          Comment


          • #6
            Hi Mahesh,

            Please read the bold area of message.
            Following are the steps:

            <start-actions>
            <action bean="passwordResetFormAction" method="setupForm"/>
            </start-actions>

            <start-state idref="enterUsername"/>

            <view-state id="enterUsername" view="passwordReset/usernameForm">

            <transition on="cancel" to="finish"/>

            <transition on="submit" to="startReset">

            If i remove this action tag,Handler able to create the flowExecutionKey.I able to catch it.If we place this tag.handler creates the flow id only after method execution.I need any suggestions on this area.
            <action bean="passwordResetFormAction" method="bindAndValidate">
            <attribute name="validatorMethod" value="validateUsername"/>
            </action>
            </transition>
            </view-state>

            <action-state id="startReset">

            <bean-action bean="passwordResetManager" method="startReset">
            <method-arguments>
            <argument expression="requestScope.remoteAddress"/>
            <argument expression="requestScope.flowExecutionKey"/>
            <argument expression="flowScope.passwordReset"/>
            </method-arguments>
            </bean-action>
            <transition on="success" to="enterResetCode"/>
            </action-state>

            <view-state id="enterResetCode" view="passwordReset/resetCodeForm">
            <transition on="cancel" to="finish"/>
            <transition on="submit" to="enterNewPassword">
            <action bean="passwordResetFormAction" method="bindAndValidate">
            <attribute name="validatorMethod" value="validateResetCode"/>
            </action>
            </transition>
            </view-state>

            <view-state id="enterNewPassword" view="passwordReset/passwordForm">
            <transition on="cancel" to="finish"/>
            <transition on="submit" to="endReset">
            <action bean="passwordResetFormAction" method="bindAndValidate"/>
            </transition>
            </view-state>

            <action-state id="endReset">
            <bean-action bean="passwordResetManager" method="endReset">
            <method-arguments>
            <argument expression="requestScope.remoteAddress"/>
            <argument expression="flowScope.passwordReset"/>
            </method-arguments>
            </bean-action>
            <transition on="success" to="displayStatus"/>
            </action-state>

            <view-state id="displayStatus" view="passwordReset/displayStatus">
            <transition on="submit" to="finish"/>
            </view-state>

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

            Comment


            • #7
              I still think you should just use plain MVC for this..but you can try using the externalContext to pull the query parameters.

              Comment


              • #8
                Offcourse your right,i can use MVC.But i still stick to webflow.

                Yes i can get query parameters through externalcontext,But unfortunately i will need this query in middle of the second flow.Already i mentioned in previous post,query is generated by handler after method successful.But i need this query at the method execution.

                Is there any way to go to the second screen without the flow id?

                Comment

                Working...
                X