1.依赖的Jar包
(1). velocity-1.x.x.jar
(2). commons-collections.jar
(3). spring的基础Jar包
spring-aop
spring-web
spring-context
spring-context-support
spring-beans
spring-core
spring-webmvc
(4). servlet-api
2.在'*-servlet.xml'中配置beans
<context:component-scan base-package="com.wgc.test"></context:component-scan> <mvc:annotation-driven/> <!-- This bean sets up the Velocity environment for us based on a root path for templates. Optionally, a properties file can be specified for more control over the Velocity environment, but the defaults are pretty sane for file based template loading. --> <bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"> <property name="resourceLoaderPath" value="/WEB-INF/velocity/"/> </bean> <!-- View resolvers can also be configured with ResourceBundles or XML files. If you need different view resolving based on Locale, you have to use the resource bundle resolver. --> <bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver"> <property name="cache" value="true"/> <property name="prefix" value=""/> <property name="suffix" value=".vm"/> </bean>
3.创建视图模板
把视图模板存放在上面配置的路径中(/WEB-INF/velocity/)
4.更为详细的配置velocity.properties
<bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"> <!-- 指定velocity.properties配置文件的路径 --> <property name="configLocation" value="/WEB-INF/velocity.properties"/> </bean>
相关推荐
springMVC+Velocity+iBATIS的整合小demo
springMVC 整合velocity博客地址http://blog.csdn.net/g290095142/article/details/78181767
Spring+Hibernate+SpringMVC+Velocity+Maven整合
Spring4+Velocity2+Maven整合例子,idea开发。直接运行。
SpringMVC+ibatis+velocity整合例子,虽然比较简单。可以为没有配置好的同学作为参考。
采用最新的springmvc3.2、mybatis3.2、velocity1.7整合,完整的配置文件和测试例子,注解完成,轻量级的视图搭配
Spring+SpringMVC+Mybatis+Velocity+Maven整合
velocity+springmvc+spring+mybaitsg整合案例 用户管理 带sql ,亲自整合调试,没有问题! /* SQLyog Ultimate v8.32 MySQL - 5.6.19 : Database - test ******************************************************...
第一章 企业项目开发--maven+springmvc+spring+mybatis+velocity整合代码的github地址:https://github.
Spring MVC框架,整合了velocity,这个没有用到Hibernate,下一版本会把集成Hibernate
整合了springmvc4+hibernate4+velocity1.7的所有jar包,使用其相关技术的童鞋们,可以下载下来导入使用!
l springmvc整合velocity l 实现对用户数据的简单增删改查 4. 适用人群 本课程的定位是velocity的系统教学课程 , 从基础到进阶 , 所以只要对velocity感兴趣 , 想系统学习velocity的开发人员都可以学习本课程 ! 学习...
总结的一些内容,对springMVC 和velocity的整合开发
整合velocity和jsp 通过不同视图解析器,返回不同视图
本篇文章将通过一个简单显示用户信息的实例整合Spring mvc+mybatis+Maven+velocity+mysql. 一、.Maven工程目录 二、Spring mvc + mybatis +maven实现 1.Mysql数据库表数据
spring+springmvc+mybatis+velocity整合的小例子
UI方面的用来与模板(Templating)引擎如 Velocity、FreeMarker、JasperReports集成的类, 6. spring-core-4.1.1.RELEASE.jar spring核心包 7. spring-expression-4.1.1.RELEASE.jar spring表达语言 SpEL以"#{...}...
Velocity | 模板引擎 | [http://velocity.apache.org/](http://velocity.apache.org/) ZooKeeper | 分布式协调服务 | [http://zookeeper.apache.org/](http://zookeeper.apache.org/) Dubbo | 分布式服务框架 | ...