My annotated validation doesn't happen. The following are the code
snippets for action class and config files. When I leave the SSN field
blank and hit submit my action's execute method is called hence fails
instead of redisplay of the login page again with validation error
message. What am I missing here?
LoginAction.java
Import my.package.actions
@Valiation()
Public class LoginAction extends ActionSupport {
//
@RequiredStringValidator(message="Please enter SSN")
Public void setSsn(String ssn){
this.ssn = ssn;
}
//
Public String execute() throws Exception {
// authenticate user here
}
}
Web.xml
Added filter init param
<init-param>
<param-name>actionPackages</param-name>
<param-value>my.package.actions</param-value>
</init-param>
Struts.xml
<action name="login" class="my.pacakge.LoginAction">
<result>home</result>
<result name="failed">loginError</result>
<interceptor-ref name="autowiring"/>
<interceptor-ref name="params"/>
<interceptor-ref name="validate"/>
<interceptor-ref name="workflow"/>
</action>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]