开发者

Spring Webflow - access exception using transition.on-exception attribute

开发者 https://www.devze.com 2023-03-15 23:23 出处:网络
I wondering how can I access exception o开发者_JS百科bject using on-exception attribute? My current configuration looks like this:

I wondering how can I access exception o开发者_JS百科bject 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?


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消