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
posted
0
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
posted
0
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?
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.