隨筆 - 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)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 南昌县| 涞源县| 平度市| 红原县| 遂宁市| 屏边| 安阳市| 开鲁县| 绥宁县| 凤翔县| 杨浦区| 嘉禾县| 克拉玛依市| 洛阳市| 明星| 正镶白旗| 于都县| 闸北区| 汶上县| 宜春市| 上饶市| 遵化市| 玉溪市| 鹰潭市| 中宁县| 洱源县| 郎溪县| 太白县| 休宁县| 深泽县| 永丰县| 中卫市| 靖宇县| 仁怀市| 内丘县| 缙云县| 泗水县| 荣成市| 仪陇县| 会东县| 大理市|