Gentlemen

recently delved into a comparative study of two great Java Web frameworks - Spring MVC and Struts2

The following implementation features attracted attention.

For dispatching calls (I hope I use the correct term) in Spring MVC, the servlet is responsible: DispatcherServlet . Which in smart articles is called Front Controller.

The same role in Struts 2 is assigned to StrutsPrepareAndExecuteFilter .

What is the reason: why is the servlet in one case, the filter in the other?

And is it possible (when it is claimed), in addition to DispatcherServlet and StrutsPrepareAndExecuteFilter , to include other servlets in the processing chain?

    1 answer 1

    Well, why servlet, why filter. Features of the implementation of such, except that they are not related to each other. It is hard to imagine a construction in which two bricks lie in one place, and frameworks that do the same cannot be used in a web application either.

    Other servlets can be used, but this is not necessary if the framework is used. Otherwise, you have to exclude these servlets from the mapping.