• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring form binding error

 
Ramesh kangamuthu
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
Android IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic