java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'editFo
Posted
by mansoor
on Stack Overflow
See other posts from Stack Overflow
or by mansoor
Published on 2010-05-28T11:35:17Z
Indexed on
2010/05/28
12:12 UTC
Read the original article
Hit count: 972
spring-mvc
i am working with spring frame work. Problem is that on forgot password jsp page when i enter the right name or email address the funtion send a mail to the user. But i want when user not enter username or password the calling funtion at controoler return a exception called bind exception and return not in getSuccessView() but redirct at same page and print the Invalid user name or email id. the controller code is
following
public class EditForgotPasswordFormController extends AbstractBaseFormController{
UserManager userManager;
@Override
protected ModelAndView executeOnSubmit(ExtendedHttpServletRequest request,
ExtendedHttpServletResponse response, Object command,
BindException errors) throws Exception {
EditForgotPassword e=(EditForgotPassword)command;
String s = e.getUsernameOrEmail();
try{
userManager.getNewPassword(s);
}catch(RuntimeException exp)
{
errors.reject("Invailid Username Or EmailId",s);
return new ModelAndView("normal/profile/forgot_password");
}
return new ModelAndView(getSuccessView())
.addObject("heading", "Please Check You Email")
.addObject("message", "Your New Account Information Is sent To At Your Email Id. ");
}
public UserManager getUserManager() {
return userManager;
}
public void setUserManager(UserManager userManager) {
this.userManager = userManager;
}
}
when i am not enter the name or email id the i want redirct at following as indicate above and print message on same jsp where from request is recived........
© Stack Overflow or respective owner