9

I wondering how can I access exception object using on-exception attribute? My current configuration looks like this:

<transition on-exception="{business_exception}" to="errorView" >
</transition>

I have to access some exception attribute in errorView. Does anybody know how can I do it?

2 Answers 2

10

This is a rather undocumented part of Spring Web Flow, but according to this thread on SpringSource forum, you can access the exception directly on your view as attributes stateException and rootCauseException.

Sign up to request clarification or add additional context in comments.

1 Comment

This could work. I found anather solution here: forum.springsource.org/… "you only have direct EL access to the outer-level (via flowExecutionException) and the root-cause (via rootCauseException) exceptions"
3

rootCauseException and flowExecutionException are the right scoped variables that are accessible in the flow. These variables are populated after the transition to the new flow,so in a pseudo sense:

<transition on-exception="{business_exception}" to="errorView" >
</transition>

<view-state id="errorView">
  <on-entry>
    <evaluate expression="exceptionHandler(flowExecutionException)"/>
    <evaluate expression="exceptionHandler(rootCauseException)"/> 
  </on-entry>
</view-state>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.