OK, I did all it takes to setup the validation framework and it does work fine.
BUT there's still Two little problems which is not solved for me and in order tell you those, let me bring up this sample:
Suppose I have an action class as follows:
public class EditPartAction extends DispatchAction {
public ActionForward createPart(...params...) {
//takes you to createPart.jsp
return mapping.findForward("createPart");
}
public ActionForward editPart(...params...) {
//takes you to editPart.jsp
return mapping.findForward("editPart");
}
}
and a ActionForm class as follows:
public class EditPartForm extends ValidatorForm {
private String partCode;
private String partName;
//and getter and setter methods
}
Now, As you know, to setup validation framework properly,
in <action> element of your struts-config.xml, you have to set
the input property to the page where your form is placed,
and also set the validate property to "true" as following:
<action
attribute="editPartForm"
validate="true"
input="/system/sentinel/part/createPart.jsp"
name="editPartForm"
parameter="do"
path="/editPart"
scope="request"
type="com.ns.prsnt.struts.action.EditPartAction">
Well, the questions are:
1- What if I need to validate both forms in insertPart.jsp and createPart.jsp?
2- when I use validation for only the createPart.jsp,
it validates the form fields and displays errors even when I'm visiting the page for the first time. Why?