Velocity语法强化2之注释#与一个例子

输出第一个VTL页面!

有你的HTML文档的任何地方,都可以引用一个变量名来输出值, 如下例, 先给变量名foo 赋值为Velocity,然后将它输出到页面中. 

<html>

<body>

#set( $foo = "Velocity" )

Hello $foo World!

</body>

<html>

在这个页面上,你看到的将是 "Hello Velocity World!". 

Comments(注释)

Comments可以让你在模板中包含对VTL或其它问题的说明描述以便与阅读和理解.---但它并不会在最终输出的web pages中看到.如下示例是VTL中的一行注释. 

## This is a single line comment.

单行注释是以## 开头的一行文字.如要写下多行注释,就要像下面那样,将它们放入#* 和*#间:

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.

*#

不需要太复杂了,这两种方式己足够你给自己的页面加上充分的说明


好比java中的//和 /* 

你可能感兴趣的:(Velocity语法强化2之注释#与一个例子)