File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Neither BindingResult nor plain target object for bean name 'loginForm Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Spring
Reply Bookmark "Neither BindingResult nor plain target object for bean name Watch "Neither BindingResult nor plain target object for bean name New topic
Author

Neither BindingResult nor plain target object for bean name 'loginForm

Geeta Puttappanavar
Ranch Hand

Joined: Jan 18, 2012
Posts: 34
Hi,

I'm new to Spring. Trying to develop a small login application. But I' getting the exception. Here is my code & exception









here is the exception




Please help me. since from 4 days I'm trying but no use.

Thanks,
Geeta
Rakesh Basani
Ranch Hand

Joined: Jun 04, 2012
Posts: 38
Hi geetha,
you cann't get loginForm object from the request.. You should get it by using @ModelAttribute("loginForm") annotation..
Repalce your loginAction() method with below code..


public String loginAction(@Valid @ModelAttribute("loginForm") LoginForm login, BindingResult errors) {
///LoginForm login=new LoginForm()----> for this loginform will get null;


System.out.println("<-----loginAction---->"+errors);
boolean status=loginDao.aunthenticateUser(login);

if(errors.hasErrors()){
return "Login";
}
else if(status==false){
errors.rejectValue("userName", "invalid.user");
return "Login";
}
else
return "welcome";
}


In this case, loginForm object from the jsp page automatically stored into the login object of loginAction() method parameter..
Geeta Puttappanavar
Ranch Hand

Joined: Jan 18, 2012
Posts: 34
Thank You so much Rakesh.. I got output.

Dushyant Chhetri
Ranch Hand

Joined: Oct 28, 2009
Posts: 75
Hi Geeta, Rakesh,

I am having a similar problem.

I am using the Spring validator but getting exactly the same error Geeta was getting earlier.


I have tried the solution advised by Rakesh but in vain.









PLEASE HELP..
Rakesh Basani
Ranch Hand

Joined: Jun 04, 2012
Posts: 38
Hi Dushyant,

Its been long time since I leave the Spring. But as far as I remember, you should use the same name to get the value from request.





I replaced the login name with loginForm in public String processLogin(-,-) method.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Neither BindingResult nor plain target object for bean name 'loginForm
 
Similar Threads
Can't display validation error message
Problem with validation example
org.springframework.beans.NotReadablePropertyException
problem while loading the welcome page
help with login program