I would like to know why the web.xml for Struts2 and Spring MVC are different.
Both frameworks use "front controller" MVC pattern in my understanding, but Struts2 uses a Filter and Spring MVC uses a Direct declaration of a servlet in the web.xml?
Doesn't Struts use servlets as well ? If it does then how is it that that servlet is not declared in the web.xml as it is for Spring ?
Spring MVC:
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Struts2:
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Struts2 uses :
So even if the usage of Servlet is possible (through the declaration of an excluded pattern) in a Struts2 application... no, Struts2 doesn't use Servlets at all.
Struts2 also puts values in the ValueStack instead of pushing them in the request, and this makes it the only mainstream Pull-MVC framework (while Spring MVC, Struts1 and others are Push-MVC frameworks)