Hi everyone
I got confuse with the call of ActionForm in Struts 1.3.8
If I have Form as follow with validate() method
public class MyTestForm extends org.apache.struts.action.ActionForm {
String myTestString;
public MyTestForm() {
super();
}
public String getMyTestString() {
return myTestString;
}
public void setMyTestString(String newString) {
this.myTestString =newString;
}
@Override
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
//do validation of myTestString
return errors;
}
}
And I have Action class as
public class UploadAction extends org.apache.struts.action.Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
MyTestForm myForm = (MyTestForm) form;
//Other operation
}
}
Now when I debug with debugging point at both validate() and execute()
method's first statement what i found is the control never goes to
validate() method. I was guessing control should go to validate method
first then only to execute method. In other word my input was never
validated.
What I am doing wrong? Can anyone help me out in this?
Thanks in advance
Anjib