springmvc 配置文件详解


<?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:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd">                    
    <!-- xml 实现  -->
    <!-- name 为path class 为相关处理的java类 -->
    <bean name="/user" class="com.bokesoft.yigo.controller.UserController" ></bean>
   
    <!--MultiController 为多方法处理  path /test1/multi?active=方法名  --> 
   <bean name="/test1/multi" class="com.tgb.web.controller.MultiController">
  <property name="methodNameResolver">
   <ref bean="paramMethodResolver"/>
  </property>
 </bean>
 
 <!-- 静态资源文件配置 -->
 <mvc:resources location="/js/" mapping="/js/**">
 </mvc:resources>
 
 
 <bean name="/test1/helloworld" class="com.tgb.web.controller.HelloWorldController" />
    <!-- 这个是在一个类中有多方法处理  区分方式为 active=方法名称  -->
 <bean id="paramMethodResolver" class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver">
  <property name="paramName" value="active">
 </property> 
 </bean>
   <!-- 这个是视图分解器 -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
            id="internalResourceViewResolver">
        <!-- 前缀 -->
        <property name="prefix" value="/" />
        <!-- 后缀 -->
        <property name="suffix" value=".jsp" />
    </bean>
</beans>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM