隨筆 - 2  文章 - 2  trackbacks - 0
          <2011年11月>
          303112345
          6789101112
          13141516171819
          20212223242526
          27282930123
          45678910

          留言簿

          隨筆檔案(1)

          文章分類(16)

          最新隨筆

          搜索

          •  

          最新評論

          在應用的 dispatcher-servlet.xml 中添加如下配置:
              <bean id="velocityConfigurer" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
                  
          <property name="resourceLoaderPath"><!-- 頁面文件的路徑,相對于webapp -->
                      
          <value>templates</value>
                  </property>
                  
          <!-- Velocity屬性配置 -->
                  
          <property name="velocityProperties">
                      
          <props>
                          
          <prop key="input.encoding">UTF-8</prop><!-- 指定模板引擎進行模板處理的編碼 -->
                          
          <prop key="output.encoding">UTF-8</prop><!-- 指定輸出流的編碼 -->
                          
          <prop key="contentType">text/html;charset=UTF-8</prop><!-- contentType -->
                          
          <prop key="velocimacro.library">macro/macros.vm</prop><!-- Velocimacro 模板庫的列表 -->
                          
          <prop key="eventhandler.referenceinsertion.class">com.sde.common.web.escape.reference.NoEscapeHtmlReference</prop>
                          
          <prop key="eventhandler.noescape.html.match">/(?:screen_content)|(?:noescape_.*)/</prop>
                      
          </props>
                  
          </property>
              
          </bean>

              
          <bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver">
                   
          <property name="cache" value="false" /><!--是否緩存模板-->
                    
          <property name="prefix" value="" />
                   
          <property name="suffix" value=".vm" />
                   
          <property name="toolboxConfigLocation" value="/WEB-INF/toolbox.xml" /><!--toolbox配置文件路徑-->
                    <property name="dateToolAttribute" value="date" /><!--日期函數名稱-->
                    <property name="numberToolAttribute" value="number" /><!--數字函數名稱-->
                   
          <property name="contentType" value="text/html;charset=UTF-8" />
                    
          <property name="exposeSpringMacroHelpers" value="true" /><!--是否使用spring對宏定義的支持-->        
                    <property name="exposeRequestAttributes" value="true" /><!--是否開放request屬性-->
           
                   <property name="requestContextAttribute" value="rc"/><!--request屬性引用名稱-->
                       <property name="layoutUrl" value="templates/layout/default.vm"/<!--指定layout文件-->
             </bean>
          posted on 2011-11-24 15:57 liucs 閱讀(6607) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 织金县| 襄汾县| 瑞金市| 介休市| 阳山县| 吉安市| 临江市| 镇远县| 宿迁市| 多伦县| 西充县| 尉犁县| 绥化市| 商南县| 新乐市| 方正县| 青川县| 凤庆县| 松滋市| 灵川县| 华安县| 科技| 潼关县| 云南省| 博爱县| 东乡族自治县| 齐齐哈尔市| 手机| 招远市| 台北市| 连南| 兴山县| 萨迦县| 哈尔滨市| 筠连县| 黄平县| 城固县| 会宁县| 新乡市| 华坪县| 荣昌县|