I have an issue with mvc:resources
My main-servlet.xml
**
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="50000000" />
</bean>
<mvc:resources mapping="/images/**" location="/images/" />
<mvc:resources mapping="/css/**" location="/css/" />
**
When I comment the mvc:resources lines everything (else) starts working magically. But when I uncomment the lines, ONLY the resources work. While compiling, log says that ONLY css/** and images/** were mapped and that there is no other mapping.
Web.xml File :
<servlet-mapping>
<servlet-name>main</servlet-name>
<url-pattern>/css/**</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>main</servlet-name>
<url-pattern>/images/**</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>main</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
I tried putting 2 dispatcher servlets but that doesn't working either. The other servlet gets read and does get mapped but the request defaults to the main servlet.
Compilation log AFTER commenting /css/** and /images/** from web.xml :
**
org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/images/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
Nov 26, 2013 11:40:40 AM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/css/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#1'
Nov 26, 2013 11:40:40 AM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'resources': initialization completed in 220 ms
Nov 26, 2013 11:40:40 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'main'
Nov 26, 2013 11:40:40 AM org.springframework.web.servlet.FrameworkServlet initServletBean
**
INFO: FrameworkServlet 'main': initialization completed in 234 ms
Nov 26, 2013 11:40:40 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Nov 26, 2013 11:40:40 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Nov 26, 2013 11:40:53 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/KT/] in DispatcherServlet with name 'main'