<package name="default" namespace="/" extends="struts-default"> <action name="whateverAction" class="com.tw511.common.action.WhateverAction" > <interceptor-ref name="workflow"> <param name="excludeMethods">whateverMethod</param> </interceptor-ref> <result name="success">pages/whatever.jsp</result> </action> </package>
然而,在上面的程式碼片段,動作類被宣告為自己的攔截器, 它會導致繼承「defaultStack」攔截器的直接丟失。
如果你想保持「defaultStack」攔截器,並覆蓋工作流的excludeMethods引數呢?沒問題,試試這個:
<package name="default" namespace="/" extends="struts-default"> <action name="whateverAction" class="com.tw511.common.action.WhateverAction" > <interceptor-ref name="defaultStack"> <param name="workflow.excludeMethods">whateverMethod</param> </interceptor-ref> <result name="success">pages/whatever.jsp</result> </action> </package>