I am using Spring 3.0.5. I have all my static assets in a folder named "static" in the root of my web application (at the same level as WEB-INF). How do I match the URLs of the form "http://mydomain.com/context-path/static/some-asset" in my "static" folder?
This is complicated by the fact that I have a view definition tool that displays in the root context (from my web.xml) ...
<servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextClass</param-name> <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
Ok, thanks for any help, - Dave
PS - Adding mvc: resources did not seem to heal the pain. I added parentContext.xml to my file ...
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <mvc:resources mapping="/static/**" location="/static/"/>
but then received exceptions: "SEVERE: Servlet.service () for the servlet manager threw javax.servlet.ServletException: no adapter for handler [ com.myco.systems.leadsmonitor.web.controller.HomeController@6870 c52d]: did your handler execute a supported interface such as a controller?" when I visited my "/" homepage.
source share