velocity注释 Velocity模板中的注释
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注释 Velocity模板中的注释的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: 泰国杰特宁医院到底怎么样?听到的答案都不
 - 下一篇: 禁止鼠标右键代码 禁止按键F5和禁止鼠标