• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Neither BindingResult nor plain target object for bean name 'user' available as request attribute

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the Neither BindingResult nor plain target object for bean name 'user' available as request attribute exception when ever there is a form:input path tag in my jsp

Can you please tell me the solution for this


 
Ranch Hand
Posts: 32
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
provide some code snippet...
 
Aruna Lukka
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Controller

public class UserDtls extends SimpleFormController {



protected ModelAndView processFormSubmission(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
User user=(User)command;
System.out.println("User name is "+user.getUserName());
System.out.println("User location is "+user.getLocation());

return new ModelAndView("First","user",user);

}
}


Mapping in Dispatcher Servlet
<bean id="userDtls" class="com.training.controller.UserDtls">
<property name="commandName">
<value>user</value>
</property>
<property name="commandClass">
<value>com.training.beans.User</value>
</property>
<property name="formView">
<value>welcome</value>
</property>


</bean>


Code in the jsp

<form:form name="user" commandName="user" action="user.htm" method="post">
Welcome To Spring Training Name<form:input path="userName"/> <input type="submit" value="submit">



</form:form>

Thank for your reply
 
Tekchand Prasad
Ranch Hand
Posts: 32
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the constructor

 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to take out "First" local argument from the return ModelAndView, if it not fix the problem then you need to make sure everything is configured correctly.

Try Annotation form controller instead, it's straight forward and no need for XML configuration.

Hope it help...
 
Aruna Lukka
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried the above constructor code but it is not working. Can I solve my problem with out using annotation. Can you please tell me the good tutorial for learning springs
 
Tekchand Prasad
Ranch Hand
Posts: 32
Hibernate Spring Java
 
    Bookmark Topic Watch Topic
  • New Topic