我想知道如何使用異常屬性來訪問異常對象? 我現在的配置是這樣的:Spring Webflow - 使用transition.on-exception屬性的訪問異常
<transition on-exception="{business_exception}" to="errorView" >
</transition>
我訪問errorView一些例外屬性。 有誰知道我該怎麼做?
我想知道如何使用異常屬性來訪問異常對象? 我現在的配置是這樣的:Spring Webflow - 使用transition.on-exception屬性的訪問異常
<transition on-exception="{business_exception}" to="errorView" >
</transition>
我訪問errorView一些例外屬性。 有誰知道我該怎麼做?
這是Spring Web Flow的一個相當undocumented一部分,但根據this線程SpringSource的論壇,您可以在視圖直接訪問異常,因爲屬性stateException
和rootCauseException
。
rootCauseException和flowExecutionException是在流中可訪問的右側範圍變量。這些變量在過渡到新流程之後被填充,因此在僞意義上:
<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>
這可能工作。我在這裏找到了anather解決方案:http://forum.springsource.org/showthread.php?58614-Can-evaluate-method-in-on-exception-transition-see-exception「你只有直接EL訪問外部 - 級別(通過flowExecutionException)和根源(通過rootCauseException)異常「 – pzieba