spring-mvc拦截器<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!--// 不是用默认过滤规则(指定包内全部扫描), 手动设置规则,只扫描@Controller注解的类。--> <context:component-scan base-package="com.prs.dps" use-default-filters="false"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <!--启用 MVC注解(@Controller,@RequestMapping)实现URL映射--> <mvc:annotation-driven/> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" > <property name="prefix" value="/WEB-INF/views/"/> <property name="suffix" value=".jsp"/> </bean>程序启动后日志:23-Jul-2016 14:05:35.050 WARNING [http-apr-8080-exec-2] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/dps/WEB-INF/views/index.jsp] in DispatcherServlet with name 'dps'23-Jul-2016 14:05:37.841 WARNING [http-apr-8080-exec-7] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/dps/WEB-INF/views/index.jsp] in DispatcherServlet with name 'dps'web根目录变成了/dps/WEB-INF而不是/WEB-INF ?????????
3 回答

万千封印
TA贡献1891条经验 获得超3个赞
在web.xml中把url-pattern改成/就行了
<servlet-mapping>
<servlet-name>dps</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
没有找到匹配的内容?试试慕课网站内搜索吧
添加回答
举报
0/150
提交
取消