-
Jan 5th, 2006, 07:28 PM
#1
MultiActionController
I have one simple question.
If I use a SimpleformController then I can setCommand class and CommandName in the .xml file as follows
<property name="commandName"><value>loginCommand</value></property>
<property name="commandClass"><value>com.command.LoginComman d</value></property>
So my controller as knows what class (in this acse LoginCommand) does the spring:bind input parameters get bound to.
So, I can comfortably use spring:bind path="loginCommand.firstName" etc from my View jsp page
My question is :------
Likewise if I am using MultiActioncontroller, then what way can i let controller and View know that com.command.LoginCommand is corresponding binding class ?
bcoz, in .xml if I put
<property name="commandName"><value>loginCommand</value></property>
<property name="commandClass"><value>com.command.LoginComman d</value></property>
for MultiActioncontroller it start complaining that you cannot configure commandName and commandClass for MultiActioncontroller...........
That is fine. But then what is other way, i can let MultiActioncontroller know that this is my commnadClass and then comfortably use the spring:bind in my Jsp page, without getting error ??
thanks,
pp
-
Jan 5th, 2006, 10:35 PM
#2
Hi,
In the MultiActionController, you can pass the command object as the third parameter to the methods that you define.
Then Spring will be able to populate the command object and you can use the spring:bind tag to bind it to the command object.
This link will help.
http://www.springframework.org/docs/...ontroller.html
-
Oct 20th, 2006, 08:17 AM
#3
same problem
Same problem,
I read the doc of MultiActionController and i set my own command as an static class, just like the example in the Pro SpringMVC book, but the binds in the jsp still dosen't work.
For any command the name of the command is "command" (getDefaultCommandName of the MultiActionController class) but i have this error:
java.lang.IllegalStateException: Neither Errors instance nor plain target object for bean name 'command' available as request attribute
at org.springframework.web.servlet.support.BindStatus .(BindStatus.java:137)
at org.springframework.web.servlet.tags.form.Abstract DataBoundFormElementTag.getBindStatus(AbstractData BoundFormElementTag.java:165)
at org.springframework.web.servlet.tags.form.ErrorsTa g.shouldRender(ErrorsTag.java:86)
at org.springframework.web.servlet.tags.form.Abstract HtmlElementBodyTag.writeTagContent(AbstractHtmlEle mentBodyTag.java:41)
at org.springframework.web.servlet.tags.form.Abstract FormTag.doStartTagInternal(AbstractFormTag.java:90 )
at org.spring......
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules