`
xifei321
  • 浏览: 20179 次
  • 性别: Icon_minigender_1
  • 来自: 无锡
文章分类
社区版块
存档分类
最新评论

Spring MVC 使用 velocity 配置

阅读更多
dispatcher-servlet.xml ----Spring MVC 容器配置文件
===============================================
<beans>       
       <bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
          <property name="viewClass">
             <value>org.springframework.web.servlet.view.velocity.VelocityView</value>
            </property>
//×.vm文件放在类加载路径下 ,由ClasspathResourceLoader加载。 (VelocityConfigurer 属性 resourceLoaderPath未设置的情况)       
           <property name="prefix">
              <value>/org/</value>
           </property>
           
            <property name="suffix">
              <value>.vm</value>
           </property>
       </bean>
       <bean class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
//指定视图资源位置
   <property name="resourceLoaderPath" value="/WEB-INF/velocity/" />
        </bean>
。。。。。

</beans>
需要类库:
com.springsource.org.apache.commons.beanutils-1.7.0.jar
com.springsource.org.apache.commons.collections-3.2.0.jar
com.springsource.org.apache.commons.lang-2.1.0.jar
com.springsource.org.apache.velocity-1.5.0.jar
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics