日期:2014-05-20 浏览次数:20874 次
public ActionErrors validate(ActionMapping mapping,HttpServletRequest request){ ActionErrors errors=new ActionErrors(); if(username.equals("")||username==null){ errors.add("username",new ActionMessage("username")); } if(password.equals("")||password==null){ errors.add("password",new ActionMessage("password")); } return errors; }
------解决方案--------------------
如果给你例子的话太长了
给你一个网站吧
http://www.blogjava.net/max
------解决方案--------------------
@Override
public void validate() {
System.out.println( " Calling validate() " );
if ( ! (loc.equals(Locale.US) || loc.equals(Locale.CHINA))) {
addFieldError( " loc " , getText( " validation.loc " ));
}
}