springmvc配置文件

来源:互联网 发布:ubuntu flash命令行 编辑:程序博客网 时间:2024/05/17 05:05
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans   
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd   
    http://www.springframework.org/schema/tx   
    http://www.springframework.org/schema/tx/spring-tx-3.0.xsd  
    http://www.springframework.org/schema/context  
    http://www.springframework.org/schema/context/spring-context-3.0.xsd  
    http://www.springframework.org/schema/mvc  
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
    <!-- 自动扫描的包名 -->
    <context:component-scan base-package="com.controller"></context:component-scan>
    <!-- 默认的注解映射的支持 -->
    <mvc:annotation-driven />
    <!-- 视图解释类 -->
    <bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/" />
        <property name="suffix" value="" /><!--可为空,方便实现自已的依据扩展名来选择视图解释类的逻辑 -->
        <property name="viewClass"
            value="org.springframework.web.servlet.view.JstlView" />
    </bean>

</beans>


若不在web.xml中配置名字及路径则文件名为:springMVC-servlet.xml

默认路径在WEB-INF根目录下

原创粉丝点击