스프링 3.0.5를 사용하고 있습니다. 내 정적 자산은 내 웹 응용 프로그램의 루트에있는 "정적"폴더에 있습니다 (WEB-INF와 동일한 수준). "http://mydomain.com/context-path/static/some-asset"형식의 URL을 "정적"폴더에 매핑하는 방법은 무엇입니까? Spring 애플 리케이션에서 정적 자산을 어떻게 매핑합니까?
이
이 어떤 도움을 ... 나는 (내 web.xml 파일에서) 루트 컨텍스트에 매핑되는 뷰 리졸버를 가지고 있다는 사실에 의해<!-- Declare a Spring MVC DispatcherServlet as usual -->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- Configure DispatcherServlet to use AnnotationConfigWebApplicationContext
instead of the default XmlWebApplicationContext -->
<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>
좋아, 덕분에 복잡 - 데이브
추 신 : mvc : resources를 추가해도 고통을 치유하지 못하는 것 같습니다. 의 Servlet.service() 서블릿 디스패처에 대한 예외를 javax.servlet.ServletException 던졌다 : 나는 SEVERE은 "... 내 parentContext.xml 파일에
<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/"/>
을 추가하지만 예외를 가지고 핸들러 없음 어댑터를 [COM .myco.systems.leadsmonitor.web.controller.HomeController @ 6870c52d] : 처리기가 Controller와 같은 지원되는 인터페이스를 구현합니까? " 내 홈페이지 "/"를 방문했을 때.
<mvc:annotation-driven />
나는 그것이 왜 일어나는지 알고 있지만 때하지 않습니다
parentcontext.xml은 무엇입니까? 대개 dispatcher-servlet.xml 파일에 넣습니다. – Bozho