2011-06-29 21 views

回答

9

這是Spring Web Flow的一個相當undocumented一部分,但根據this線程SpringSource的論壇,您可以在視圖直接訪問異常,因爲屬性stateExceptionrootCauseException

+0

這可能工作。我在這裏找到了anather解決方案:http://forum.springsource.org/showthread.php?58614-Can-evaluate-method-in-on-exception-transition-see-exception「你只有直接EL訪問外部 - 級別(通過flowExecutionException)和根源(通過rootCauseException)異常「 – pzieba

2

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> 
相關問題