velocity

Velocity can't find resource

↘锁芯ラ 提交于 2019-11-27 02:38:11
问题 Something is wrong and it is very frustrating. I read on velocity's homepage that when I run a webapp then some properties should be set. And I've done that but no matter what I do I keep getting the same error. This is where I set the props and use velocity public class ConfirmationMailGenerator implements MailGenerator { private BasicUser user; private String htmlTemplate = "HTMLConfirmationMailTemplate.vsl"; private String plainTemplate = "PlainConfirmationMailTemplate.vsl"; public

Velocity中的ComparisonDateTool、MathTool、NumberTool、SortTool、EscapeTool工具

≯℡__Kan透↙ 提交于 2019-11-27 01:41:40
可以从Apache官方网站自带的例子中查找,位置\velocity-tools-1.4-src\examples\showcase。 Apache官方网站自带的例子有下面一些: AlternatorTool BrowserSniffer ContextTool CookieTool DateTool EscapeTool ImportTool LinkTool ListTool MathTool IteratorTool NumberTool PagerTool ParameterParser RenderTool ResourceTool SearchTool SortTool 使用Velocity Tools的时候,一定要在toolbox.xml中指定,然后在应用的web.xml中配置。 这里,关于jar包的引用,很可能出现一种Velocity运行时异常,例如: 信息: Velocity [warn] org.apache.velocity.runtime.exception.ReferenceException: reference : template = /templates/context.vm [line 12,column 37] : $context is not a valid reference. 2008-4-23 9:41:45 org.apache

How to use String as Velocity Template?

坚强是说给别人听的谎言 提交于 2019-11-26 22:42:39
问题 What is the best way to create Velocity Template from a String? I'm aware of Velocity.evaluate method where I can pass String or StringReader, but I'm curios is there a better way to do it (e.g. any advantage of creating an instance of Template). 回答1: There is some overhead parsing template. You might see some performance gain by pre-parsing the template if your template is large and you use it repeatedly. You can do something like this, RuntimeServices runtimeServices = RuntimeSingleton

construct variable names dynamically in velocity

ぃ、小莉子 提交于 2019-11-26 21:38:32
问题 I would like to know if it is possible to construct name of variable into velocity dynamically. i.e. lets say I've 6 variables into velocity template [name1, name2, name3 .. name6] I would like to output them. So I'm looking in something like: #foreach ( $counter in [1..6] ) ${name${counter}} #end is it possible somehow? 回答1: It is possible using the #evaluate directive: #evaluate ('$name1') #set ($d = '$') #foreach ($i in [1..6]) #set ($varName = "${d}name${i}") #evaluate($varName) #end 回答2:

Velocity.js的使用

拟墨画扇 提交于 2019-11-26 12:12:43
转自: https://www.cnblogs.com/xiaohuochai/p/7404928.html ------------------------------------------------------------------------------------------------------------------------》》》 Velocity.js的使用 前面的话   Velocity是一款优秀的JS动画库,完全可以作为jQuery的 animate 的替代品。需要动画功能时,使用Velocity是一个好选择。本文将详细介绍 Velocity.js 的使用 概述   Velocity是一个简单易用、高性能、功能丰富的轻量级JS动画库。它和jQuery的 animate() 有相同的API, 但它不依赖 jQuery,可单独使用。Velocity不仅包含了$.animate()的全部功能,还拥有:颜色动画、转换动画(transforms)、循环、缓动、SVG动画和滚动动画等特色功能。它比$.animate()更快更流畅,性能甚至高于CSS3 animation,是jQuery和CSS3 transition的最佳组合,它支持所有现代浏览器,最低可兼容到IE8和Android 2.3 【下载】   可以通过官网直接下载Velocity.js, 下载地址  

从老板到项目成员,如何从燃尽图中洞悉团队工作?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 09:52:55
很多时候,我们感觉什么都没干一天就过去了,但对领导者来说,事情最好已经提前做完了,而且是越快越好。聪明的管理者知道,“时间”是需要花大功夫去把控的限制因素,只有掌握了更多关于时间和工作的数据,我们才能更好地执行计划,在预算范围内按时完成项目。 燃尽图就是用来反映此类项目数据的工具,常用于敏捷软件开发中,如Scrum。它可以呈现剩余工作量和可用剩余时间,并通过可视化的图示表述繁复文字无法表述的意思。 一、燃尽图是什么? 燃尽图可以呈现团队处理用户故事进度,是一种对工作完成情况可视化展示的工具,燃尽图可显示每次迭代工作总量中仍需完成的工作余量。 燃尽图的横轴显示工作天数,纵轴显示剩余工作,反映了项目启动以来的进度情况,它让每个团队成员都能够看到当前的进度,团队需定期更新燃尽图以保持其准确性。 目前存在两种形式的燃尽图,Sprint燃尽图用于显示迭代中的剩余工作量,而产品燃尽图则用于说明整个项目的剩余工作量。 二、常见燃尽图类型有哪些? CORNERSTONE 将燃尽图分为七种情况,个人根据理解及实际情况修改如下几种: Case1:完美型。特征:一条直线。图形如下: 这种情况除非你团队都是神,否则基本上不可能出现这种情况。如果你的团队是这样的图,很可能遇到了个假的团队:本燃尽图纯属虚构,如有完美纯属巧合。 Case2:啤酒肚。特征:圆弧状,且实际曲线一直在理想直线上方。图形如下:

String replacement in java, similar to a velocity template

故事扮演 提交于 2019-11-26 08:06:50
问题 Is there any String replacement mechanism in Java, where I can pass objects with a text, and it replaces the string as it occurs. For example, the text is : Hello ${user.name}, Welcome to ${site.name}. The objects I have are \"user\" and \"site\" . I want to replace the strings given inside ${} with its equivalent values from the objects. This is same as we replace objects in a velocity template. 回答1: Use StringSubstitutor from Apache Commons Text. https://commons.apache.org/proper/commons

复合和继承

梦想与她 提交于 2019-11-25 20:09:02
这里举一个继承的初始化例子 // reuse/Detergent.java // (c)2017 MindView LLC: see Copyright.txt // We make no guarantees that this code is fit for any purpose. // Visit http://OnJava8.com for more book information. // Inheritance syntax & properties class Cleanser { private String s = "Cleanser"; public void append(String a) { s += a; } public void dilute() { append(" dilute()"); } public void apply() { append(" apply()"); } public void scrub() { append(" scrub()"); } @Override public String toString() { return s; } public static void main(String[] args) { Cleanser x = new Cleanser(); x.dilute(); x.apply();