PDA

View Full Version : How to set a "dummy" commend object within AbstractCommandController?


Dong Liu
May 18th, 2007, 06:18 PM
I know this is a strange request. That is why any suggestion is welcome.

I have AbstractCommandController-derived DisplayStatementController, and SimpleFormController-derived EditStatementController. However, due to special requirement on page design, I would like both controller to access a jsp page EditStatement.jsp. This EditStatement.jsp has to be used by SimpleFormController, so it has <form:form commandName="stmt">.
Now I need to create a command object stmt from database in DisplayStatementController (which derives from AbstractCommandController), and pass this object to EditStatement.jsp and let the <form:form ...> code pick it up as a command object.
I assume that, like Struts, the command object in Spring is passed to jsp pages as an object in request object. However, I could not find it. That is why I cannot impost my object as a command object to the jsp page.
I will read into the source code to get some ideas.
Any suggestion on solution, hint, or hint to source code will be appreciated.

Jörg Heinicke
May 19th, 2007, 11:05 AM
There is technically no difference in handling the command object in both AbstractCommandController and SimpleFormController. So creating your command object should be done the same way in both controllers. Where is your problem?

Jörg