action 有两个:form , action
form:
public class BeerSelectForm extends ActionForm { // actionform is struts-class
public ActionErrors validate(ActionMapping mapping , HttpServletRequest request){
ActionErrors errors = new ...;
errors.add("color",new ActionError("color not valid");
return errors;
}
}
action:
public class BeerSelectAction extends Action{
public ActionForward execute(ActionMapping mapping,ActionForm form,
HttpServletRequest request, ... response){
...
return mapping.findForward("operation"); // operation is a forward-name in 'struts-config.xml'
}
}