aspose file tools*
The moose likes Spring and the fly likes Neither BindingResult nor plain target object for bean name 'user' available as request attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
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 'user' available as request attribute

Aruna Lukka
Greenhorn

Joined: Sep 15, 2011
Posts: 5
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


Tekchand Prasad
Ranch Hand

Joined: Oct 20, 2005
Posts: 32
provide some code snippet...
Aruna Lukka
Greenhorn

Joined: Sep 15, 2011
Posts: 5
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

Joined: Oct 20, 2005
Posts: 32
Use the constructor

Tommy Delson
Ranch Hand

Joined: Apr 13, 2011
Posts: 206
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...


OCPJP6-05-11
"Your life is in your hands, to make of it what you choose."
Aruna Lukka
Greenhorn

Joined: Sep 15, 2011
Posts: 5
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

Joined: Oct 20, 2005
Posts: 32
http://static.springsource.org/spring/docs/2.0.x/reference/index.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Neither BindingResult nor plain target object for bean name 'user' available as request attribute