Spring MVC relies on DispatcherServlet
, which sends requests to controllers that are configurable mapping handlers with view and theme resolution. In Struts, the controller's name is Action
. While Action
instances will be instantiated for every request in Struts 2 to tackle the thread safety issue, Spring MVC creates controllers once, and each controller's instance serves all requests.
To enable Spring integration with Struts 2, Struts provides struts2-spring-plugin
. In Struts 2.1, Struts introduced the convention plugin (struts2-convention-plugin
), which simplified the creation of Action
classes (by annotation) without any configuration file (struts.xml
). The plugin expects a set of naming conventions for the Action
class, package, and view naming that will be explained in this section.
To integrate Struts 2 with Spring, you need to add these dependencies:
<dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core<...