-
Nov 15th, 2011, 08:51 PM
#1
Neither BindingResult nor plain target object for bean name 'loginInfo' available
Dear all,
Could someone please explain this error to me in my code. I am using SimpleFormController like this. But I am getting the following error. Any help would be highly appreciated. Thanks a lot.
"Neither BindingResult nor plain target object for bean name 'loginInfo' available as request attribute"
Model Class is: LoginInfo
#code: Controller:
protected ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object o,BindException errors)
{
LoginInfo loginInf = new LoginInfo();
loginInf.setUserID("error");
mv = new ModelAndView("loginForm");
mv.addObject("Error", loginInf);
return mv;
}
jsp: snippet.
<form:form commandName="loginInfo" method="POST" action="login.html">
<div><% LoginInfo error = (LoginInfo)request.getAttribute("Error");
System.out.println(error);
if(error != null){
%> User ID or Password is Incorrect.
<%}%>
</div>
#spring-xml file:
<bean id="loginController"
class="com.controller.LoginController">
<property name="loginServiceBO" ref="loginServiceBO" />
<property name="formView" value="loginForm"/>
<property name="successView" value="itemDisplay"/>
<property name="commandName" value="loginInfo"/>
<property name="commandClass" value="com.LoginInfo"/>
-
Nov 20th, 2011, 03:06 PM
#2
Hello Kumar
1) use code tags, it is more readable for us
2) This error has been covered a lot of times in the forum years ago, do a search in the forum
3) it is old, proceed to move to @Controller
Let me know your advace
- Manuel Jordan
Kill Your Pride, Share Your Knowledge With All
The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7
Blog
Technical Reviewer of Apress
- Pro SpringSource dm Server
- Spring Enterprise Recipes: A Problem-Solution Approach
- Spring Recipes: A Problem-Solution Approach, 2nd Edition
- Pro Spring Integration
- Pro Spring Batch
- Pro Spring 3
- Pro Spring MVC: With Web Flow
- Pro Spring Security
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules