springmvc配置文件...(权当参考)

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
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.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.zn.contrller"></context:component-scan>
<!--配置mvc注解驱动-->
<mvc:annotation-driven></mvc:annotation-driven>
<!--内部资源视图解析器-->
<!--简单的说就是将jsp页面的前缀和后缀单独写出来,这样就可以直接写jsp页面的名字了,我在这里和别的jsp放在一起,所以只需要在前缀加上"/"-->
<bean id="resourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
<!--开发静态资源访问权限-->
<!--DispatcherServlet(前端控制器)请求映射配置为"/",则Spring MVC将捕获Web容器所有的请求,包括静态资源的请求,Spring MVC将它们当成一个普通请求处理,
在这里开放的访问路径权限会将springmvc中捕获的静态资源重新发送回服务器,让服务器处理-->
<mvc:default-servlet-handler></mvc:default-servlet-handler>


</beans>

猜你喜欢

转载自www.cnblogs.com/znzuinb/p/11721279.html