<form-bean name="RegisterForm" type="com.mysite.form.RegisterForm" />
<action path="/register" type="com.mysite.action.RegisterAction" name="RegisterForm" input="/register.jsp" validate="true">
<forward name="success" path="/welcome.jsp" />
<forward name="failure" path="/register.jsp" />
</action>
RegisterForm
public class RegisterForm extends ActionForm{
private String name;
/**
Constructor
Set+Get
**/
public ActionErrors validate(ActionMapping mapping, ServletRequest request) {
ActionErrors errorList = new ActionErrors();
System.out.println("VALIDATING");
return errorList;
}
}
这就是我的全部。出于某种原因,似乎控制流直接跳转到ActionForm的execute方法,因为我甚至无法在控制台中看到VALIDATING消息。有什么我想念的吗?谢谢!
答案 0 :(得分:1)
您需要使用另一个带有HttpServletRequest
的重载validate()方法