Announcement Announcement Module
No announcement yet.
Is there a multiaction form controller or equivilent? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is there a multiaction form controller or equivilent?

    Similar to Struts MappingDispatchAction. The typical example is to have all operations of a shoppping cart contained within one java class. I know that there is the MultiActionController, but it doesn't seem to offer the form processing that I'm looking for (seems to be provided by BaseCommandController and it's subclasses). Does this functionality already exist or can you point me in the right direction for implementing it?


  • #2
    Actually, the MultiActionController has some form binding functionality. Look at the JavaDoc of the MultiActionController:

    * Controller implementation that allows multiple request types to be
    * handled by the same class. Subclasses of this class can handle several
    * different types of request with methods of the form
    * <pre>
    * ModelAndView actionName(HttpServletRequest request, HttpServletResponse response);</pre>
    * May take a third parameter HttpSession in which an existing session will be required,
    * or a third parameter of an arbitrary class that gets treated as command
    * (i.e. an instance of the class gets created, and request parameters get bound to it)
    Rod Johnson's J2EE without EJB book also discusses this, but unfortunately the Spring reference documentation does not. So I suggest you just look at the source code of the MultiActionController to find out the details.