top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

When and how to use MultiActionController in Spring MVC?

+2 votes
When and how to use MultiActionController in Spring MVC?
posted Oct 1, 2013 by Arvind Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

MultiActionController supports the aggregation of multiple request-handling methods into one controller, so allows you to group related functionality together. It is capable of mapping requests to method names and then invoking the correct method to handle a particular request.
Using the MultiActionController is especially useful when you have a lot of related functionality that would perhaps be appropriate to define all in a single class without having to implement one Controller for each bit of functionality.
There are two ways to use MultiActionController.
1.Subclass the MultiActionController and specify the methods that will be resolved by the MethodNameResolver.
2.You need to define a delegate object, on which methods resolved by the MethodNameResolver will be invoked. You will need to inject delegate object into the MultiActionController bean as a collaborator.

answer Oct 2, 2013 by Vinay Shukla