Results 1 to 4 of 4

Thread: Multiple Command Objects per Controller

  1. #1

    Default 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.

  2. #2
    Join Date
    Apr 2006
    Location
    Canada
    Posts
    164

    Default

    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?
    Chris Lee (blog)
    Principal Consultant
    Digital Ascent Inc.

  3. #3

    Default

    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

  4. #4
    Join Date
    Apr 2006
    Location
    Canada
    Posts
    164

    Default

    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.
    Chris Lee (blog)
    Principal Consultant
    Digital Ascent Inc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •