博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Velocity模板中的注释
阅读量:7059 次
发布时间:2019-06-28

本文共 1471 字,大约阅读时间需要 4 分钟。

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

  *#

转载地址:http://jlrol.baihongyu.com/

你可能感兴趣的文章
NetBeans 设置code completion/auto pop-up delay
查看>>
【.NET深呼吸】INotifyPropertyChanged接口的真故事
查看>>
Linux 命令快捷键
查看>>
构建一个用于产品介绍的WEB应用
查看>>
深入浅出WPF 第一部分(3)
查看>>
StringTokenizer类的使用
查看>>
Java并发框架??AQS中断的支持
查看>>
11g RAC R2 体系结构---Grid
查看>>
sql server 2005 外围应用配置器
查看>>
[MODx] 9. Real Example
查看>>
健康饮食
查看>>
Visual Studio 2015年预览设置: 辅助安装程序说明
查看>>
(转)在NGUI使用图片文字(数字、美术字)(直接可用于UILable)
查看>>
javascript动态创建script标签,加载完成后调用回调
查看>>
Linq 实现两个对象实例List之间的赋值
查看>>
Bézier curve
查看>>
七天学会ASP.NET MVC (一)——深入理解ASP.NET MVC
查看>>
中国目前拥有的物种和人造卫星的作用
查看>>
7 Tools for Data Visualization in R, Python, and Julia
查看>>
【转】ubuntu apt-get update 失败解决
查看>>