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