溫馨提示:您的每一次轉(zhuǎn)載,體現(xiàn)了我寫此文的意義!!!煩請(qǐng)您在轉(zhuǎn)載時(shí)注明出處http://www.aygfsteel.com/sxyx2008/謝謝合作!!!

          雪山飛鵠

          溫馨提示:您的每一次轉(zhuǎn)載,體現(xiàn)了我寫此文的意義!!!煩請(qǐng)您在轉(zhuǎn)載時(shí)注明出處http://www.aygfsteel.com/sxyx2008/謝謝合作!!!

          BlogJava 首頁 新隨筆 聯(lián)系 聚合 管理
            215 Posts :: 1 Stories :: 674 Comments :: 0 Trackbacks
          說明一下目錄結(jié)構(gòu)
           
          Spring配置文件
          <?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:p
          ="http://www.springframework.org/schema/p"
              xmlns:context
          ="http://www.springframework.org/schema/context"
              xsi:schemaLocation
          ="
              http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
              http://www.springframework.org/schema/context
              http://www.springframework.org/schema/context/spring-context-3.0.xsd"
          >
              
          <context:component-scan
                  
          base-package="com.spring.action" />
              
          <!--  
                  org.springframework.web.servlet.view.ResourceBundleViewResolver
                  用于多個(gè)視圖集成時(shí),ResourceBundleViewResolver是通過解析資源文件來解析請(qǐng)求輸出文件的。
                  <property name="basename" value="views"></property>,即表示在/WEB-INF/classes路徑下有一個(gè)
                  views.properties文件,本例中views.properties的內(nèi)容為
                  welcome.(class)=org.springframework.web.servlet.view.velocity.VelocityView
                  welcome.url=welcome.vm
                  freemarker.(class)=org.springframework.web.servlet.view.freemarker.FreeMarkerView
                  freemarker.url=freemarker.ftl
              
          -->
              
          <bean class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
                  
          <property name="basename" value="views"></property>
                  
          <!-- 
                      <property name="order" value="0"></property>
                  
          -->
              
          </bean>
              
              
          <!-- jsp視圖解析器 -->
              
          <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
                  
          <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
                  
          <property name="prefix" value="/"/>
                  
          <property name="suffix" value=".jsp"/>
              
          </bean>        
              
              
          <!-- velocity視圖解析器 -->
              
          <bean id="velocityViewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
                  
          <property name="cache" value="true"/>
                  
          <property name="prefix" value="/"/>
                  
          <property name="suffix" value=".vm"/>
              
          </bean>
              
              
          <!-- velocity環(huán)境配置 -->
              
          <bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
                  
          <!-- velocity配置文件路徑 -->
                  
          <property name="configLocation" value="/WEB-INF/velocity.properties"/>
                  
          <!-- velocity模板路徑 -->
                  
          <property name="resourceLoaderPath" value="/WEB-INF/velocity/"/>
              
          </bean>
              
              
          <!-- FreeMarker環(huán)境配置 -->
              
          <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
                  
          <!-- freemarker模板位置 -->
                  
          <property name="templateLoaderPath" value="/WEB-INF/freemarker/"/>
              
          </bean>
              
              
          <!-- FreeMarker視圖解析 -->
              
          <bean id="freeMarkerViewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
                  
          <property name="cache" value="true"/>
                  
          <property name="prefix" value="/"/>
                  
          <property name="suffix" value=".ftl"/>
              
          </bean>
          </beans>
          views.properties
          #welcome為modelAndView.setViewName("welcome");中的welcome   .(class)固定寫法
          welcome.(class)=org.springframework.web.servlet.view.velocity.VelocityView
          #welcome.url 路徑 welcome.vm模板名稱
          welcome.url
          =welcome.vm

          #freemarker為modelAndView.setViewName(
          "freemarker");中的freemarker   .(class)固定寫法
          freemarker.(class)=org.springframework.web.servlet.view.freemarker.FreeMarkerView
          #freemarker.url 路徑 freemarker.ftl模板名稱
          freemarker.url
          =freemarker.ftl
          點(diǎn)我下載示例代碼
          posted on 2011-07-13 17:14 雪山飛鵠 閱讀(12836) 評(píng)論(4)  編輯  收藏 所屬分類: spring

          Feedback

          # re: SpringMvc多視圖整合(jsp、velocity、freemarker)[未登錄] 2012-07-09 17:09
          你的lib可以發(fā)給我嗎。446409852@qq.com  回復(fù)  更多評(píng)論
            

          # re: SpringMvc多視圖整合(jsp、velocity、freemarker) 2013-05-11 19:02 rosetears
          使用過程中出現(xiàn)中文亂碼,把視圖使用order屬性沒有出現(xiàn)亂碼。  回復(fù)  更多評(píng)論
            

          # re: SpringMvc多視圖整合(jsp、velocity、freemarker) 2013-06-25 20:18 andy andy
          你的lib可以發(fā)給我嗎。294667591@qq.com  回復(fù)  更多評(píng)論
            

          # re: SpringMvc多視圖整合(jsp、velocity、freemarker) 2015-12-10 20:55 ls2008
          我也想要SpringMvc多視圖整合(jsp、velocity、freemarker)這個(gè)項(xiàng)目的jar包啊,你的lib可以發(fā)給我, 909074489@qq.com  回復(fù)  更多評(píng)論
            

          主站蜘蛛池模板: 宽城| 汉寿县| 阿坝县| 丰原市| 齐齐哈尔市| 静宁县| 汉寿县| 大关县| 思茅市| 墨竹工卡县| 阳曲县| 沧州市| 滦南县| 离岛区| 桐柏县| 江都市| 古交市| 惠来县| 监利县| 宁蒗| 潮安县| 博野县| 利川市| 墨江| 肇东市| 拉孜县| 长治县| 涿鹿县| 勃利县| 芦溪县| 老河口市| 敦煌市| 维西| 班玛县| 临城县| 永登县| 桃源县| 南平市| 宁武县| 宁夏| 深泽县|