In Struts2, can we have both validation xml (ActionClass-method-validation.xml) and validate method implemented in Action class.
I was asking as this validation xml don't get invoked in my situation.
In Struts2, can we have both validation xml (ActionClass-method-validation.xml) and validate method implemented in Action class.
I was asking as this validation xml don't get invoked in my situation.
hope you have created proper rule file actionname-validation.xml (note- actionname is case sensitive) and kept it in same package as of Action class.
Also, if you do not have default interceptor configured then please add validation interceptor in Struts.xml within that particular action tag.
<action name="welcome" class="com.abc.web.WelcomeAction">
<interceptor-ref name="validation" />
<result name="success" >hello.jsp</result>
</action>
Refer for more details about Validation framework at http://struts.apache.org/2.0.14/docs/validation.html and http://java.dzone.com/articles/struts2-tutorial-part-37