I am new to struct 2.0. I am trying to run my first small apllication with interceptor and want to use validation for only excecute method.
But it call validate function before both populate and excecute method. Can anyone please tell me what i am missing.
Following is my SampleAction class.
package demo;
import com.opensymphony.xwork2.ActionSupport;
public class SampleAction extends ActionSupport {
private static final long serialVersionUID = 1L;
public void validate()
{
System.out.println("validate() method called");
}
public String populate()
{
System.out.println("populate() method called");
return "populate";
}
public String execute()
{
System.out.println("execute() method called");
return SUCCESS;
}
}
And Following is my struct.xml file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="default" extends="struts-default">
<action name="*Sample" method="{1}" class="demo.SampleAction">
<interceptor-ref name="defaultStack" >
<param name="validation.excludeMethods"> populate</param>
<result name="populate">/first.jsp</result>
<result name="success">/success.jsp</result>
</action>
</package>
</struts>