Error and Validation Messages
More good news! Spring recognizes Struts message bundles in an identical format. In order to reuse your existing Message resources within Spring MVC, you just configure it as messageSource in the Spring MVC configuration file as follows:
Also, you would need to use it, like your Controllers, as a messageSource property in your Controller implementations. No other changes are required.
Spring MVC has its own version of the Request Processor/Action Servlet. It is DispatcherServlet, which is mapped to a group of URL expressions. To understand the concept of the Dispatcher Servlet, look at how Controllers are configured in Spring MVC.
As a Struts user, you are used to having at least one struts-config.xml file (or more if you are using modules) that holds all the forwards, action mappings, form definitions, and plug-in declarations. In Spring MVC, all the Web application-related controller declarations are configured as Spring Beans. One or more Dispatcher Controllers dispatch all requests for the Web resources to the appropriate Controllers. For instance, if you want to remap your ".do" application into a Spring MVC application, you register the following servlet mapping in the web.xml of your application (I am not actually recommending that you use .do as an extension. Leave “.do” as a Struts-only convention.):
Now you have a Spring configuration file (applicationDispatcher-servlet.xml) with your Spring MVC Controller declarations. Note the “-servlet.xml” suffix for the applicationDispatcher file. It is a Spring MVC convention that enables DispatcherServlet to auto-load Spring MVC mapping files.
Mapping Web actions to the appropriate controllers in Spring MVC is quite easy. It is done in the same "wiring" fashion as the rest of the Spring application. The following example shows how to forward URL expression /showCatalog.do into a Controller showCatalog:
The Controller showCatalog would be configured as another bean implemented by a class that implements Controller interfaces. In this example, showCatalog is nothing more than a simple forwarding controller that forwards URL requests to a ModelAndView component named catalog:
<bean id="showCatalog" name="showCatalog"
<property name="viewName" value="catalog"/>