Page 1 of 2 12 LastLast
Results 1 to 10 of 11

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

  1. #1
    Join Date
    Oct 2008
    Posts
    286

    Default 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 at 08:03 PM.
    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

  2. #2
    Join Date
    Oct 2008
    Posts
    286

    Default

    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...
    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

  3. #3
    Join Date
    Nov 2008
    Posts
    742

    Default

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

  4. #4
    Join Date
    Oct 2008
    Posts
    286

    Default

    Quote 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" />
    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

  5. #5
    Join Date
    Nov 2008
    Posts
    742

    Default

    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.

  6. #6
    Join Date
    Oct 2008
    Posts
    286

    Default

    Quote 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;
    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

  7. #7
    Join Date
    Oct 2008
    Posts
    286

    Default

    Quote Originally Posted by topwzp View Post
    Thankiossk Cool!
    anybody can guide me on.. thanks in advanced..
    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

  8. #8
    Join Date
    Nov 2008
    Posts
    742

    Default

    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.

  9. #9
    Join Date
    Jul 2008
    Posts
    157

    Default

    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>

  10. #10
    Join Date
    Oct 2008
    Posts
    286

    Default

    in SWF2.0.8.RELEASE version, TransitionExecutingStateExceptionHandlerwas removed?

    and replaced by TransitionExecutingFlowExecutionExceptionHandler?
    Last edited by eros; Mar 20th, 2010 at 04:18 AM.
    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

Posting Permissions

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