*
The moose likes Other Application Frameworks and the fly likes Spring form binding error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Spring form binding error" Watch "Spring form binding error" New topic
Author

Spring form binding error

Ramesh kangamuthu
Ranch Hand

Joined: Mar 13, 2007
Posts: 79
Hi,
I am in the developing of a Spring database application for user registration and login authentication. After configuring beans in dispatcher-servlet properly, I used Spring bind tag and form tags in that
In my jsp I used

<form:form>
<Spring:bind path="loginUser.username">
<input type="text" name="<c ut value='${status.expression}'/>"
value="<c ut value='${status.value}'/>" size="20"/>
</Spring:bind>

..........
.........

</form:form>

I have the bean configured in the xml file with the id "loginUser" with two properties with the names "username" and "password" and they have values set.

When I try to bind the form inputs to command object the following error comes.

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

Also I used the

setCommandName(LoginUser.class);

setCommandClass("loginUser");

methods inside the LoginController's constructor.

Could anybody explain how to bind form inputs to command object and retrieve it.

Thanks

Ramesh Kangamuthu
Pavel L Lechev
Greenhorn

Joined: Jan 23, 2008
Posts: 3

what you have to do is to set a request scoped attribute 'loginUser' to hold the data object.

Using the standard Spring MVC classes, you would have something like this in your controller :



The Spring form tag classes will search the request for attribute with the name 'loginUser' to populate the form field.

Cheers
[ February 12, 2008: Message edited by: Pavel L Lechev ]
baby baby
Greenhorn

Joined: Oct 27, 2008
Posts: 1
Are you able to resolve the issue? I am facing the same issue and i tried the solution that is provided, but no luck. Could you please let me know how did you solve it?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Originally posted by baby baby:
Are you able to resolve the issue? I am facing the same issue and i tried the solution that is provided, but no luck. Could you please let me know how did you solve it?


"baby baby"

Please click on the My Profile link above and change your display name to meet the JavaRanch Naming Policy of using your real first and real last names.

Thank you

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
GeeCON Prague 2014
 
subject: Spring form binding error