您的位置:首页 > 编程语言

jenkins+github+maven+selenium在mac上持续集成(CI)

2014-08-14 12:15 429 查看
velocity luna 安装velocity插件解决方案

折腾了两天,velocity都没装上。ok 。原因很简单。eclipse4.4就不支持velocity。。。。重新装了eclipse 4.3就好了。直接用个 trunk版本的在现状http://veloeclipse.googlecode.com/svn/trunk/update/靠。折腾死人了。各种配置。eclipse4.4这算bug啊,还是velocity不更新就不能支持下一代eclipse了 啊。。。

在Spring的配置文件applicationContext.xml中配置velocity视图解析器。

velocityConfig:

configLoation里放velocity.perperties 属性文件。里面记录了 velocity模板的扫描位置,输入输出编码格式等,这是一个全局配置。

velocimacro.permissions.allow.inline=true
velocimacro.permissions.allow.inline.to.replace.global=true
velocimacro.permissions.allow.inline.local.scope=true
input.encoding=UTF-8
output.encoding=UTF-8
contentType=text/html;charset=UTF-8

resource.loader=webapp, class
class.resource.loader.description=Velocity Classpath Resource Loader
class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
webapp.resource.loader.class=org.apache.velocity.tools.view.WebappResourceLoader
webapp.resource.loader.path=/WEB-INF/velocity/
webapp.resource.loader.cache=false


如上属性文件里的对象。如下: VelocityLayoutViewResolver是基于格局的一种resolver,layoutUrl里放模板的url。
<!-- velocity视图解析配置 http://kim-miao.iteye.com/blog/1053928 -->
<bean id="velocityConfig"
class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<property name="configLocation">
<value>/WEB-INF/velocity/velocity.properties</value>
</property>
<property name="resourceLoaderPath">
<value>/WEB-INF/velocity/</value>
</property>
<property name="velocityProperties">
<props>
<prop key="input.encoding">utf-8</prop>
<prop key="output.encoding">utf-8</prop>
</props>
</property>
</bean>

<bean id="viewResolver"
class="org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver">
<property name="cache" value="true" />
<property name="layoutUrl" value="/layout/main.vm" />
<property name="prefix" value="/templates/" />
<property name="suffix" value=".vm" />

<property name="allowSessionOverride" value="true" />
<property name="allowRequestOverride" value="true" />
<property name="exposeSessionAttributes" value="true" />
<property name="requestContextAttribute" value="rc" />
<property name="exposeRequestAttributes" value="true" />
</bean>

注意layout类型的界面布局因为是嵌套式的界面布局,尽量少用,容易出错。

比如下一节会讲到的ztree整合velocity 因为ztree也是嵌套式界面布局,结果导致循环嵌套,界面错误了。

一般来说,使用如下布局结构

<bean id="viewResolver" 	class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
<property name="prefix" value="/template/"/>
<property name="suffix" value=".vm" />
<property name="contentType">
<value>text/html;charset=utf-8</value>
</property>
</bean>
<bean id="viewResolverSession"  class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
<property name="suffix">
<value>.vm</value>
</property>
<property name="contentType">
<value>text/html;charset=utf-8</value>
</property>
<property name="exposeSessionAttributes">
<value>true</value>
</property>
</bean>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: