Announcement Announcement Module
Collapse
No announcement yet.
Neither BindingResult nor plain target object for bean name 'loginInfo' available Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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"/>

  • #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

    Comment

    Working...
    X