静态文件目录
web.xml拦截方式 /
<servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <!-- 默认/WEB-INF/[servlet名字]-servlet.xml加载上下文, 如果配置了contextConfigLocation参数, 将使用classpath:/mvc-dispatcher-servlet.xml加载上下文 --> <param-name>contextConfigLocation</param-name> <param-value>classpath:/springmvc-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <!-- 拦截匹配的请求,这里所有请求采用名字为mvc-dispatcher的DispatcherServlet处理 --> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
springmvc-servlet.xml
<!-- 静态文件访问 --> <!-- <mvc:resources mapping="/WEB-INF/static/**" location="/WEB-INF/static/" /> --> <mvc:default-servlet-handler /> <!-- 配置开启注解 --> <mvc:annotation-driven />
时间: 2024-10-10 01:37:53