Announcement Announcement Module
No announcement yet.
Passing a model/cmd from Controller to SimpleFormController Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Passing a model/cmd from Controller to SimpleFormController

    I have a regular Controller (let's called it A) which does some fancy processing, and builds a non-trivial command object as its result. It then redirects to another Controller (and this form is B), this time, it's a SimpleFormController.

    I'd like to use the command built by A as the form backing object in B.

    I've been placing the object in the HttpSession, and pulling it out in B's formBackingObject(). Is there a way to pass it as part of the model from A and get to it in B? Placing it in the session seems like a bad idea.

    This seems like something that shouldn't be too hard to do. I've stepped through the code and it all makes sense, I am surprised not to find some flag or setting which just does what I need. Maybe I'm missing something?


  • #2
    If you are really redirecting then I don't see any way around putting the object into the session (you can always take it out); alternatively you could override the formBackingObject() on controller B and use the request.get/setAttribute to store it in the current request if you use RequestDispatcher.forward.