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