Velocity ——VTL模板中的注释

  注释允许在模板中包含描述文字,而这些文字不会被放置到模板引擎的输出中。注释是一种有效的提醒自己和向别人解释你的VTL语句要做什么事情的方法。你也可以把注释用来做其他你认为有用的用途。下面就是一个注释的例子。

  ## This is a single line comment.

  一个单行的注释以##开始,直到行尾才结束。如果你要写很多行的注释,那么不用使用多各单行注释,VTL还提供了多行注释。多行注释以#*开始,以*#结束。下面是一个多行注释的例子。

  This is text that is outside the multi-line comment.

  Online visitors can see it.

  #*

  Thus begins a multi-line comment. Online visitors won't

  see this text because the Velocity Templating Engine will

  ignore it.

  *#

  Here is text outside the multi-line comment; it is visible.

  在使用Velocity引擎解析上面的模板时,输出的结果是:

  This is text that is outside the multi-line comment.

  Online visitors can see it.

  Here is text outside the multi-line comment; it is visible.

  可以看到,多行注释内的内容是不会输出的。

  下面的例子阐明了注释的用法:

  This text is visible. ## This text is not.

  This text is visible.

  This text is visible. #* This text, as part of a multi-line comment,

  is not visible. This text is not visible; it is also part of the

  multi-line comment. This text still not visible. *# This text is outside

  the comment, so it is visible.

  ## This text is not visible.

  用Velocity引擎解析上面的模板,输出的结果是:

  This text is visible. This text is visible.

  This text is visible. This text is outside

  the comment, so it is visible.

  在VTL中还有第三种注释:VTL注释块。VTL注释块用来保存如文档的作者、版本号等信息。例如:

  #**

  This is a VTL comment block and

  may be used to store such information

  as the document author and versioning

  information:

  @author

  @version 5

  *#

Velocity模板中的注释的更多相关文章

  1. Spring中使用Velocity模板

    使用Velocity模板 Velocity是一种针对Java应用的易用的模板语言.Velocity模板中没有任何 Java代码,这使得它能够同时被非开发人员和开发人员轻松地理解.Velocity的用户 ...

  2. flask的jinja2模板中过过滤器的相关小内容

    jinja2模板中有自带的过滤器,有需要直接拿来使用.也可以自己定义过滤器 在过滤器中,有一些常见得操作及关键字.有对字符串的操作,还有对大小写转换的操作.还有对list的操作 过滤器的语法 {# 过 ...

  3. Velocity模板学习(一)

    一.Velocity是什么 Velocity是一个基于Java的模板引擎,允许任何人仅仅简单地使用模板语言就可以引用由Java代码编写的对象. 二.Velocity的基本语法 1.变量 变量的定义 在 ...

  4. velocity模板引擎学习(4)-在standalone的java application中使用velocity及velocity-tools

    通常velocity是配合spring mvc之类的框架在web中使用,但velocity本身其实对运行环境没有过多的限制,在单独的java application中也可以独立使用,下面演示了利用ve ...

  5. IDEA中设置注释模板的方法

    IDEA中设置注释模板主要分为两个部分,分别是创建java文件时类的注释和方法的注释. 这里为大家详细介绍一下方法,按MyEclipse的风格设置(MyEclipse的请看:MyEclipse中设置注 ...

  6. SpringBoot 项目中使用velocity模板(转载)

    (不要使用这种模板了,spring boot最新版已经不支持了.使用FreeMarker吧:http://blog.csdn.net/clementad/article/details/5194262 ...

  7. 如何在Android Studio中添加注释模板信息?

    如何在Android Studio中添加注释模板信息? 在开发程序的时候,我们一般都会给文件自动添加上一些关于文件的注释信息,比如开发者的名字,开发的时间,开发者的联系方式等等.那么在android ...

  8. eclipse中自定义注释模板

    eclipse中自定义注释模板 2018年10月09日 10:51:27 lm_y 阅读数 857更多 分类专栏: java Java   编辑注释模板的方法:Window->Preferenc ...

  9. Velocity模板引擎语法

    Velocity 模板引擎介绍 Velocity是一个基于java的模板引擎(template engine).它允许任何人仅仅简单的使用模板语言(template language)来引用由java ...

随机推荐

  1. topcoder 643 DIV2

    太弱了,太弱了! A:基本的判断吧,然后就是边界问题,写了好久,结果发现时房间第二个交的.. B:真心跪了,还好想出来了,思路想的太慢太慢,结果交上去,落后太多,不过HACK时很多人挂了, 这也是DI ...

  2. 帝国cms无法注册登录快速解决方法 附路径

    帝国cms安装相对比较简单,一路next,一般从网上下载的系统都会带一些数据,恢复备份数据后,清除缓存,更新数据,一个copy版的网站就出来了.但是为了se的友好需要改动很多地方,不然很容易被认为是s ...

  3. RDLC报表BC4000错误

    如果RDLC报表报 BC4000错误,那是因为在矩阵外上面添加了文本框的缘故,导致系统不能读到RDLC报表表体,告诉你报表没有定义: 解决办法: 把表头文字放入矩阵中.

  4. C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\Team Foundation\4.0\Cache\VersionControl.config is not valid and cannot be loaded.

    Recently, we experienced a strange problem with TFS 2010. We spent a few days before we figured it o ...

  5. (转)单机上配置hadoop

    哈哈,几天连续收到百度两次电话,均是利好消息,于是乎不知不觉的自己的工作效率也提高了,几天折腾了好久终于在单机上配置好了hadoop,然后也成功的运行了一个用例,耶耶耶耶耶耶. 转自:http://w ...

  6. POJ 2092

    #include <iostream> #include <algorithm> #define MAXN 10005 using namespace std; int _m[ ...

  7. android 启动adb

    1.命令行进入 sdk/platform-tools 2.执行命令 adb kill-server 3.执行命令 adb start-server

  8. shell如何自动输入密码

    shell如何自动输入密码 http://linux.ctocio.com.cn/171/12162171.shtml

  9. ExtJs之单选及多选框

    坚持 <!DOCTYPE html> <html> <head> <title>ExtJs</title> <meta http-eq ...

  10. poj 3228(二分+最大流)

    题目链接:http://poj.org/problem?id=3228 思路:增设一个超级源点和一个超级汇点,源点与每一个gold相连,容量为gold数量,汇点与仓库相连,容量为仓库的容量,然后就是二 ...