spring mvc配置文件

<?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:context="http://www.springframework.org/schema/context"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xsi:schemaLocation="http://www.springframework.org/schema/beans classpath:/org/springframework/beans/factory/xml/spring-beans-3.2.xsd
                http://www.springframework.org/schema/context classpath:/org/springframework/context/config/spring-context-3.2.xsd
                http://www.springframework.org/schema/aop classpath:/org/springframework/aop/config/spring-aop-3.2.xsd
                http://www.springframework.org/schema/tx classpath:/org/springframework/transaction/config/spring-tx-3.2.xsd
                http://www.springframework.org/schema/mvc classpath:/org/springframework/web/servlet/config/spring-mvc-3.2.xsd">

    <mvc:annotation-driven/>
    <!-- 配置control的扫描路径,只扫描com.hsj.controller路径下面的@Controller  -->
    <context:component-scan base-package="com.hsj.controller" />
    <!-- 对于资源文件直接映射 -->
    <mvc:resources location="/static/" mapping="/static/**"/>
    <!-- 配置注解的适配器类,默认选项有改适配器,不配置也可以使用注解进行开发 -->
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
    <!-- 配置视图解析器,有标准的jsp解析器,freemark视图解析器 -->
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
        <property name="prefix"><value>/WEB-INF/page/</value></property>
        <property name="suffix"><value>.jsp</value></property>
    </bean>
</beans>

时间: 2024-08-26 06:51:17

spring mvc配置文件的相关文章

spring mvc 配置文件:

标准方法是在web.xml中配置两个,然后在spring mvc配置文件中注解只扫controller注解,其余spring不扫controller注解 一.最开始当然是web.xml文件了,这是一个总的宏观配置 <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee&q

Spring MVC 配置文件dispatcher-servlet.xml 文件详解

<?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/sch

Spring MVC 配置文件 web.xml文件详解

<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.s

Spring MVC 配置文件dispatcher-servlet.xml 文件详解(转自 学无止境-yj)

<?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/sch

spring mvc 配置文件拦截器过滤url

最近在用spring mvc拦截器,sprin 版本号4.0.6.RELEASE, <mvc:interceptor> <mvc:mapping path="/admin/**" /> <ref bean="manageInterceptor"/> </mvc:interceptor> 这个mvc:mapping 配置的值是拦截器有效的url匹配  之前/admin/* 这样只会拦截/admin/一级的url, 然后加

spring mvc配置文件简单实现

ContextLoaderListener:Spring MVC在Web容器中的启动类,负责Spring IoC容器在Web上下文中的初始化,使得容器能够自动装配ApplicationContext的配置信息. 在web.xml中配置该类: <listener> <listener-class>org.springframework.web.context.ContextLoaderListener </listener-class> </listener>

Spring MVC配置文件解释

<?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:context="http://www.springframework.org/sche

spring mvc配置文件dispatcher-servlet.xml详解

<?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

spring mvc修改配置文件路径

1.1.  Classpath 工程目录 在web.xml文件如下配置: <!-- 配置spring mvc 的核心servlet --> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <