创建了一个ssm框架的项目,但是在运行的时候,出现了一个bug,就是在运行的时候js,css,以及一些静态资源被拦截,无法加载;
web中的配置如下:
<?xml version="1.0" encoding="UTF-8"?>
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="taotao" version="2.5">
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<!-- 加载spring容器 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/applicationContext-*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- springmvc的前端控制器 -->
<servlet>
<servlet-name>mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- contextConfigLocation不是必须的, 如果不配置contextConfigLocation, springmvc的配置文件默认在:WEB-INF/servlet的name+"-servlet.xml" -->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/springmvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<filter>
<filter-name>CharacterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet-mapping>
<servlet-name>mvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
spring mvc中的配置如下:
<mvc:annotation-driven/>
<!--包扫描器 -->
<context:component-scan base-package="com.ny.controller" />
<!--视图解析器 -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<!--配置静态资源映射,防止静态资源被拦截 -->
<mvc:resources location="/WEB-INF/css/" mapping="/css/**"></mvc:resources>
<mvc:resources location="/WEB-INF/js/" mapping="/js/**"></mvc:resources>
<mvc:resources location="/WEB-INF/images/" mapping="/images/**"/>
<mvc:resources location="/WEB-INF/lay/" mapping="/lay/**"/>
<mvc:resources location="/WEB-INF/font/" mapping="/font/**"/>
</beans>
配置在Tomcat插件运行时没有错误,但是在本地的Tomcat运行的时候,抛出如下信息:
DEBUG [http-bio-8080-exec-3] - DispatcherServlet with name 'mvc' processing GET request for [/School/baoming]
DEBUG [http-bio-8080-exec-3] - Looking up handler method for path /baoming
DEBUG [http-bio-8080-exec-3] - Returning handler method [private java.lang.String com.ny.controller.BaomingController.transfer()]
DEBUG [http-bio-8080-exec-3] - Returning cached instance of singleton bean 'baomingController'
DEBUG [http-bio-8080-exec-3] - Last-Modified value for [/School/baoming] is: -1
DEBUG [http-bio-8080-exec-3] - Rendering view [org.springframework.web.servlet.view.JstlView: name 'baoming'; URL [/WEB-INF/jsp/baoming.jsp]] in DispatcherServlet with name 'mvc'
DEBUG [http-bio-8080-exec-3] - Forwarding to resource [/WEB-INF/jsp/baoming.jsp] in InternalResourceView 'baoming'
DEBUG [http-bio-8080-exec-3] - Successfully completed request
想问下各位哪错了??