<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!--自动扫描包-->
<context:component-scan base-package="shao"/>
<!--让Spring MVC不处理静态资源-->
<mvc:default-servlet-handler/>
<!--开启注解扫描-->
<mvc:annotation-driven/>
<!--视图解析器对象-->
<bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!--表示到/WEB-INF/pages目录下去找-->
<property name="prefix" value="/WEB-INF/pages/"/>
<!--所找文件后缀名为.jsp-->
<property name="suffix" value=".jsp"/>
</bean>
</beans>
springmvc-servlet.xml 配置
本文介绍了如何在SpringMVC项目中进行组件扫描,配置InternalResourceViewResolver处理JSP视图,并防止SpringMVC处理静态资源的方法。
摘要由CSDN通过智能技术生成