Announcement Announcement Module
Collapse
No announcement yet.
upon FlowInputMappingException,would like to set the message and back to calling flow Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • upon FlowInputMappingException,would like to set the message and back to calling flow

    I have <input id="simulationAnalyzeId" required="true"/> tag within Flow2

    Flow1 passes the the simulationAnalyzeId via requestParameters.simulationAnalyzeId..

    when the simulationAnalyzeId value is null/empty... it throws FlowInputMappingException..

    would like to handle it, then set the messageContext and back to the calling flow..

    anybody knows how to implement this?

    thanks
    Last edited by eros; Mar 17th, 2010, 09:03 PM.

  • #2
    anybody may give me ideas or hints on how to catch the FlowInputMappingException then set a message in messageContext and back to calling flow...

    or other way to address this issue...

    Comment


    • #3
      Can you supply a bit more? For example, the relevant portions of your flow definition? analyzeId should still get exposed in requestParameters...

      Comment


      • #4
        Originally posted by InverseFalcon View Post
        Can you supply a bit more? For example, the relevant portions of your flow definition? analyzeId should still get exposed in requestParameters...
        yes it is exposed in requestParameters but the problem is the errors occurrs within the flowExecution (im not sure)..

        it is possible to check it within the validator even it is set as requestParameters?

        or if other way to implement this... please give me your precious ideas...

        Flow1
        Code:
        	<view-state id="enterFlow1" view="view-flow1" model="model1" >
        		<on-render>
        		</on-render>
        
        		<transition on="gotoFlow2" to="enterFlow2" ></transition>
        		
        		<transition on="modoru" to="shuryo" />
        	</view-state>
        
        	<end-state id="enterFlow2" view="externalRedirect:/flow2-flow?simulationAnalyzeId=${requestParameters.simulationAnalyzeId}" />
        
        	<end-state id="shuryo" view="externalRedirect:/view-menu" />
        Flow2
        Code:
        	<input name="simulationAnalyzeId" required="true" />
        
        	<on-start>
        	
        	</on-start>
        
        	<view-state id="enterFlow2" view="view-flow2" model="model2">
        		
        		<transition on="modoru" to="shuryo"/>
        
        	</view-state>
        
        	<end-state id="shuryo" view="externalRedirect:/flow1-flow" />

        Comment


        • #5
          Can you confirm your input element for me? I see an "id" attribute, but no "name" attribute. Maybe this is the problem? Also, you're using "analyzeId" on the page, but expecting "simulationAnalyzeId" in your requestParameters. You're going to have to standardize on one or the other.

          Comment


          • #6
            Originally posted by InverseFalcon View Post
            Can you confirm your input element for me? I see an "id" attribute, but no "name" attribute. Maybe this is the problem? Also, you're using "analyzeId" on the page, but expecting "simulationAnalyzeId" in your requestParameters. You're going to have to standardize on one or the other.
            sorry for confusing posts..

            i am using location.href to call the transition event..

            jsp
            Code:
            // get the selected Id from the table(grid)
            var analyzeId = getSelectedAnalyzeId();
            
            var _url = getFlowExecutionUrl();
            
            location.href = _url + '&_eventId=gotoFlow2&simulationAnalyzeId=' + analyzeId;

            Comment


            • #7
              Originally posted by topwzp
              Thankiossk Cool!
              anybody can guide me on.. thanks in advanced..

              Comment


              • #8
                I've got little additional advice, except to proceed incrementally. First, I would check (in some kind of action) in your transition to see if simulationAnalyzeId is actually being exposed in requestParameters. If it's not, that narrows down your issue to something on the page. If it succeeds, do something similar on-entry of the end-state. If both of these are passing, then it's something between the redirect and the start of the new flow. You could check to see what's exposed in requestParameters on-start of your new flow to see if for some reason it's just not connecting with your input element.

                Comment


                • #9
                  Have you tried with exceptions-handlers:
                  Code:
                  	<!-- Apply exception handler to display messages within flow  -->
                  	<exception-handler bean="flowExceptionMessageHandler" />
                  Code:
                  public class FlowExceptionMessageHandler implements FlowExecutionExceptionHandler {
                  
                  	/** {@inheritDoc} */
                  	public boolean canHandle(FlowExecutionException ex) {
                  		return canHandle(ex.getFlowId(), ex.getStateId())
                  			&& canBuildMessage(ex);
                  	}
                  
                  	public boolean canHandle(String flowId, String stateId) {
                  		return stateId != null;
                  	}
                  
                  	/**
                  	 * Handle the exception in the context of the current request, optionally
                  	 * making an error view selection that should be rendered.
                  	 * 
                  	 * @param exception
                  	 *            the exception that got thrown during flow execution
                  	 * @param context
                  	 *            the execution control context for this request
                  	 */
                  	public void handle(FlowExecutionException ex, RequestControlContext context) {
                  		logException(ex, context);
                  		context.getMessageContext().addMessage(buildMessage(ex, context));
                  		// Redirect to originating view state to display message
                  		if (context.getCurrentState().isViewState()) {
                  			context.getExternalContext().requestFlowExecutionRedirect();
                  		} else {
                  			State originatingViewState = (State)context.getRequestScope().get("webflow.originatingViewState");
                  			if (originatingViewState != null) {
                  				context.execute(new Transition(new DefaultTargetStateResolver(originatingViewState.getId())));
                  			}
                  		}
                  	}
                  	...
                  	...
                  }
                  or transition on exception
                  Code:
                  	<global-transitions>
                  		<!-- Global transitions to global states -->
                  		<!--
                  		  - Global transition exception handling.
                  		  - Adding a transition on-exception here will override custom
                  		  - exception-handlers.
                  		  - Use only for exceptions that cannot be handle within the current
                  		  - state and need to be redirected to another url.
                  		  -->
                  	</global-transitions>
                  Code:
                  	<!--
                  	  - This state defines a new subflow to be called from
                  	  - the current one.
                  	  - When exiting a subflow execution should proceed to the previous
                  	  - view state.
                  	  -->
                  	<subflow-state id="subflow" subflow="template">
                  		<transition on="back" to="${requestScope['webflow.originatingViewState'].id}" />
                  		<transition on="previous" to="${requestScope['webflow.originatingViewState'].id}" />
                  		<transition on-exception="org.springframework.security.AccessDeniedException" to="${requestScope['webflow.originatingViewState'].id}" />
                  		<transition on-exception="FlowInputMappingException" to="${requestScope['webflow.originatingViewState'].id}" />
                  	</subflow-state>

                  Comment


                  • #10
                    in SWF2.0.8.RELEASE version, TransitionExecutingStateExceptionHandlerwas removed?

                    and replaced by TransitionExecutingFlowExecutionExceptionHandler?
                    Last edited by eros; Mar 20th, 2010, 05:18 AM.

                    Comment


                    • #11
                      Well, I think it was replace in SWF 2.0M1.

                      TransitionExecutingFlowExecutionExceptionHandler [2.0M1]

                      Comment

                      Working...
                      X