And my Controller looks like this
@RequestMapping( value = "/add", method = RequestMethod.POST )
public String addUser(
@RequestParam(value="isAdmin",defaultValue="false") Boolean isAdmin,
@RequestParam(value="passVerification" ) String passVerification,
@ModelAttribute("user") C_UserDAO newUser
) {
final BindException errors = new BindException( newUser, "user" );
m_userValidator.validate( newUser, errors );
...
if( !newUser.getPassword().equals( passVerification ) && !newUser.getPassword().equals( "" ) ) {
errors.rejectValue( "password", "user.password.missmatch", "The passwords aren't equal, try again" );
}
if( errors.hasErrors() ) {
return "addUserForm";
}
...
return "redirect:thanks.html";
}
The validation works like a charm, but when an error occures, the view doesn't change and no error is shown. I've read the documentation over and over again but i can't find a clou how to solve the problem. What's my error?
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-47843-3.html
对你来说
演员杨洋