• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
provide some code snippet...
 
Aruna Lukka
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the constructor

 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://static.springsource.org/spring/docs/2.0.x/reference/index.html
 
reply
    Bookmark Topic Watch Topic
  • New Topic