Announcement Announcement Module
No announcement yet.
how to redirect to two differents page after button clic Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to redirect to two differents page after button clic


    I'm new developper in Spring Webflow and i want to redirect my page in same page or another page after button clic.

    The webflow code for this state is :

    <view-state id="editEntity" model="entity">
    <!-- Action button -->
    <transition on="save" validate="false">
    	<evaluate expression="entityController.saveEntity(flowScope.entity)"/>
    How to add in this code this decision :

    If saveEntity return 'true' , i'll redirect in other page 'moreDetail'.
    else leave at 'editEntity'
    Thank's for your help

  • #2
    You will have 2 transitions, based on the button click. Here is some sample flow code:

    <view-state id="step1" view="test-flow/step1">
    <transition on="save" to="save"/>
    <transition on="cancel" to="cancel"/> </view-state>

    The save and cancel are states in your flow. No need for code for this logic.

    If it's more of a "after enter date, if successfully saved, go to the save page, else, go back to the edit page", I would transition to an action state, and in there, based on the result, have those same two transitions.

    Hope this helps.
    Last edited by daveb1040; Oct 22nd, 2012, 11:17 PM.


    • #3
      I've do this transition and i've this error :

      No transition found on occurence of event 'save' in state 'cloneChoice' of flow 'entitymngt/newEntity/cloneEntity'

      <view-state id="editEntity" model="entity">
           <transition on="save" to="moreAnswersNeeded" />
      <decision-state id="moreAnswersNeeded">
      		<if test="entityController.saveEntity(flowScope.entity)" then="answerClone"
      			else="saved" />		
      <subflow-state id="answerClone" subflow="entitymngt/newEntity/cloneEntity">
      		<!-- <input name="entityClone" value="flowScope.entity" /> -->
      		<input name="entityClone" value="entityController.entityToSaved" />
      		<input name="clone" value="flowScope.clone"/>
      		<input name="nbTransaction" value="entityController.nbTransactionCloned"/>
      		<input name="nbDocument" value="entityController.nbDocumentCloned"/>
      		<transition on="clone" to="cloned" />
      		<transition on="quit" to="editEntity" /> 
      		<transition on="saved" to="editEntity" />
      code of subflow

      <flow xmlns="" 
      	<persistence-context />
      	<input name="projectEdit" type="com.plasticomnium.optidoc.domain.model.entity.Project" />
      	<input name="create" type="boolean" />
      	<decision-state id="editionChoice">
      		<if test="create" then="setUpForm" else="editForm" />
      	<!-- Setting up for creating a new project -->
      	<action-state id="setUpForm">
      		<evaluate expression="projectController.createProject()" result="flowScope.project" />
      		<transition on="success" to="projectEditForm" />
      	<!-- Setting up for editing an existing project -->
      	<action-state id="editForm">
      		<set name="flowScope.project" value="projectEdit" />
      		<transition to="projectEditForm" />
      	<!-- =========== -->
      	<!-- COMMON-EDIT -->
      	<!-- =========== -->
      	<view-state id="projectEditForm">
      		<transition on="save" to="saved" validate="false" >
      			<evaluate expression="projectController.saveProject(flowScope.project)" />
      		<transition on="quit" to="quit" validate="false" />
          <!-- ========== -->
          <!-- END STATE  -->
          <!-- ========== -->
      	<end-state id="quit"/>
      	<end-state id="saved"/>