-
Dec 21st, 2006, 01:04 PM
#1
Multiple Command Objects per Controller
Hi,
I have a controller which basically has to perform depending upon user input.
I wanted to ask if there was a way to set multiple commands to the controller. If yes, how. I was thinking if there would be a command factory, but I dont know.
Please help me here.
-
Dec 21st, 2006, 01:07 PM
#2
Could you be more specific about your needs? Perhaps an example?
Since a Controller instantiates a command object to show the form, and then binds the submitted values to that object on form submission, the command object type is obviously fixed; perhaps choosing an appropriate controller is a better solution?
-
Dec 28th, 2006, 07:34 PM
#3
I have a page, which has multiple form asynchronous form submissions. Each submission invokes a unique business service. Hence, I wanted to know if there was a way map separate command to it. Perhaps, it would be better to map a different controller for a unique form submission. I dont know how to do it. Is there a way to do this then?
If yes, does each controller have to have a separate command object associated with the controller?
Thanks,
Karthik Krishnan
-
Dec 28th, 2006, 08:01 PM
#4
Spring's MVC controller's are stateless; each request is against the same instance of the controller and will maintain it's own state (i.e. command object) - so multiple asynchronous form submissions aren't a problem.
Be careful about maintaining your own state (i.e. member variables in the controller manipulated per-request or HTTP session attributes); these are best avoided if possible, otherwise appropriate synchronization is required.
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