How to exclude action methods from validation in struts2
My Action class have the following methods,
1.addAction
2.deleteAction
3.updateAction
4.populateAction
** UPDATE: Struts 2 Complete tutorial now available here.
Consider a scenario where I want to apply validation for addAction and deleteAction method alone and not for other method , then all you to do a configuration in struts.xml file by listing all the methods you don’t want to be run through the validation framework in the excludeMethods parameter. Since we only want addElement and deleteElement validated, list the other two methods as follows:
<interceptor-ref name="validation"> <param name="excludeMethods">updateAction,populateAction</param> </interceptor-ref>