+2  A: 

The web.xml file controls which context file DispatcherServlet is using. If you configure web.xml to have a DispatcherServlet with name em, then by default it uses em-servlet.xml to load the web context.

Your question is a bit confusing as to what you would actually like to do - do you want all "versions" to be available in the same instance of the application?

If so, the method you describe sounds unorthodox for how to present multiple languages / globalizing your application. Traditionally you would just have a single instance of the application and all the controllers/instances, and then handle translating user-visible messages at the display level. Spring has excellent support for this.

If your goal is to have a single instance of the application serve requests for all these languages/locales, then it sounds like you could do away with a lot of this redundancy.

matt b
I want to have all "versions" to be available in the same instance of the application?
Rachel
Also different Region has different business logic and so we cannot do that at the display level
Rachel
+1  A: 

The web.xml file can configure multiple DispatcherServlet instances, each having its own configuration. Each DispatcherServlet instance configures a WebApplicationContext separate from other DispatcherServlet instances, so you can use the same bean names without affecting the other application context.

<!-- configured by WEB-INF/ap-servlet.xml -->
<servlet>
    <servlet-name>ap</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<!-- configured by WEB-INF/em-servlet.xml -->
<servlet>
    <servlet-name>em</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

You must also configure web.xml to map requests to the appropriate DispatcherServlet. For example, each region could have a different URL path.

<servlet-mapping>
    <servlet-name>ap</servlet-name>
    <url-pattern>/ap/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>em</servlet-name>
    <url-pattern>/em/*</url-pattern>
</servlet-mapping>
Jim Huang
@Jim: This does make sense.
Rachel