I am trying to create a Spring MVC app, I have multiple dispatcher servlets in my web.xml like this:
<servlet>
<servlet-name>one-servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:appServlet/one-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>one-servlet</servlet-name>
<url-pattern>/one/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>two-servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:appServlet/two-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>webapp-servlet</servlet-name>
<url-pattern>/two/*</url-pattern>
</servlet-mapping>
And everything works fine, except one thing urls that i use in my jsp files like this:
<c:url value="/user" />
doesnt return the mapping of dispatcher servlet, i mean that i need a url like this myapp/one/user to use a controller from one-servlet, but the url i get is myapp/user
Any possibility to append the dispatsher servlet mapping to my urls without hardcoding them in jsp files ?
DispatcherServlet, it will also not work for crossDispatcherServletcommunication (so if you are in/oneand expect/user/to become/two/userthat isn't going to work). - M. Deinum