给你一个参考:
if((username==null)||(username.length()<1))
errors.add("username",new ActionMessage("error.username.required"));
if((password==null)||(password.length()<1)){
errors.add("password",new ActionMessage("error.password.required"));userId的值能打印出来,证明判断有问题。
if((username==null)||(username.length()<1))
errors.add("username",new ActionMessage("error.username.required"));
if((password==null)||(password.length()<1)){
errors.add("password",new ActionMessage("error.password.required"));userId的值能打印出来,证明判断有问题。
errors.add("username", new ActionError("errors.login.no.userid"));
}
if (( passWord == null) || (passWord.length()<3 )) {
errors.add("password", new ActionError("errors.login.no.password"));
}我改成上边这样通过了。但我有一个问题,为何两个判断里要加上(userId.length()<3)和(passWord.length()<3 )这两个条件才可以啊?难道我不判断长度,只判断是否为空,不行吗(我试了,的确不行)?关键是为什么啊?
PS:另急啊,我给分,呵呵!
String类型的将赋值为""
int将赋值为0