|
|||||
|
|||||
Useful Things |
MVEL 2.0 Orb Tags
This page contains a list of all orb-tags available out-of-the-box in the MVEL 2.0 templating engine. @{} Expression OrbThe expression orb is the most rudimentary form of orb-tag. It contains a value expression which will be evaluated to a string, and appended to the output template. For example: @code{} Silent Code TagThe silent code tag allows you to execute MVEL expression code in your template. It does not return a value and does not affect the formatting of the template in any way. This template will evaluate to: John Doe is 23 years old. @if{}-@else{} Control Flow TagsThe @if{} and @else{} tags provide full if-then-else functionality in MVEL Templates. For example:
@foreach{} Foreach iterationThe foreach tag allows you to iterate either collections or arrays in your template. Note: that the syntax for foreach has changed in MVEL Templates 2.0 to standardize the foreach notation with that of the MVEL language itself. MVEL 2.0 requires you specify an iteration variable. While MVEL 1.2 assumed the name item if you did not specify an alias, this has been dropped due to some complaints about that default action. Multi-iterationYou can iterate more than one collection in a single foreach loop at one time by comma-separating the iterations: DelimitingYou can automatically add a text delimiter to an iteration by specifying the iterator in @end{} tag. This would return something like: John, Mary, Joseph. @include{} Include Template FileYou may include a template file into an MVEL template using this tag. You may also execute an MVEL expression inside an include tag by adding a semicolon after the template name: @includeNamed{} Include a Named TemplateNamed templates are templates that have been precompiled and passed to the runtime via a TemplateRegistry, or templates that have been declared within the template itself. You simply include You may also execute MVEL code in an @includeNamed{} tag, just as with the @include{} tag. @declare{} Declare a TemplateIn addition to including external templates from external files, and passing them in programmatically, you can declare a template from within a template. Which allows you to do things like this: @comment{} Comment tagThe comment tag allows you add an invisible comment to the template. For example: Other Useful Places |
||||
|
Copyright 2003-2006 - The Codehaus. All rights reserved unless otherwise noted.
Powered by Atlassian Confluence
|
|||||