4
我的Action類有以下幾種方法,如何排除驗證在Struts2的操作方法
1.add
2.edit
3.loadEdit
4.remove
5.list
6.execute
在這方面,我需要申請驗證的添加和edit..how確實需要在struts.xml中以配置
。我跟着,
<action name="editComment" method="edit"
class="com.mmm.ehspreg2.web.action.product.CommentAction">
<result name="success">/jsp/propertyManager/loadList.jsp</result>
</action>
<action name="removeComment" method="remove"
class="com.mmm.ehspreg2.web.action.product.CommentAction">
<interceptor-ref name="validation">
<param name="excludeMethods">remove</param>
</interceptor-ref>
<result type="tiles">listComment</result>
<result type="tiles" name="input">listComment</result>
</action>
當我像這樣配置它,刪除操作方法不會被調用。我不明白這個問題。請協助。
它不工作。我對每種方法都有不同的操作。我需要在所有操作中指定這個excludethods配置嗎? – Jothi 2010-07-23 04:21:01
不,您可以在struts.xml的頂部定義自己的defaultStack。如果您在此頁面上查看「defaultStack」,您會看到當前正在運行的內容。將其複製到您自己的配置中並更改所需內容:http://struts.apache.org/2.0.14/docs/struts-defaultxml.html – Pat 2010-07-23 10:23:39