Announcement Announcement Module
No announcement yet.
Form controller support for multiple form views. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Form controller support for multiple form views.


    Perhaps I am missing something here, but I have been conditioned by my struts experiance to expect controllers to handle multiple form mappings. I understand the multiaction controller, but there does not appear to be any way to map multiple formViews to a single form controller.

    The result is that in the scenario of my project in which crud operations occur on different forms, I have had to code (class and testcase) and map three seperate controllers, all of which have similiar code. This is against. The absence of this feature is complecating my task.

    What am I missing?


    John Olmstead

  • #2
    You're saying your controller have similar code. How similar? If it's just one class that you want to map to multiple form views, you can just configure the class multiple times, each one of them with different form views.

    If the code is not completely the same, I'd refactor the common functionality into a base class (in its turn extending the form controller) and subclass the newly created superclass. You could even make the superformcontroller configurable.

    Remember, Spring does not aim to provide everything you need. Using Dependency Injection you can easily extend the functionality Spring MVC offers.


    • #3
      Multiple actions mapped to one controller.

      Thanks, that makes perfect sense.