struts问题
我在做了个添加的页面,在相映的actionForm里的validate方法做了错误处理 再在action里写了业务逻辑操作, 问题来了 :
这是actionForm里的validate方法
public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request) { ActionErrors errors=new ActionErrors();
if((name==null)||(name.length()<1)){
errors.add("name_error",new ActionError("jsp.name.error"));
}
if((password==null)||(password.length()<1)){
errors.add("password_error",new ActionError("jsp.password.error"));
}

return errors;
}这是action里的
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws SQLException {
RegisterForm registerForm = (RegisterForm) form;

Userinfo userinfo=new Userinfo();
ActionErrors errors=new ActionErrors();

if(userinfo.adddata(registerForm.getName(),registerForm.getPassword())){
return mapping.findForward("ok");
}

return null;

}我在添加数据时故意都为空,这样虽然有错误提示了,但是在数据库里仍然添加进去了,这是怎么回事,要怎么解决啊??   快帮下忙吧