You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

Velocity tags are extensions of the generic Tags provided by the framework. You can get jump right in just by knowing the structure in which the tags can be accessed: #saf*xxx *(...) ... #end, where xxx is any of the Tags supported by the framework.

For example, in JSP you might create a form using SAF tags.

JSP Form
<saf:form action="updatePerson">
    <saf:textfield label="First name" name="firstName"/>
    <saf:submit value="Update"/>
</saf:form>

In Velocity, the same form can also be built using SAF macros.

VM Form
#safform ("action=updatePerson")
    #saftextfield ("label=First name" "name=firstName")
    #safsubmit ("value=Update")
#end

Block and Inline Tags

Some VM tags require an #end statement while others do not. The inconsistency arises from a limitation in Velocity where tags must declare if they are a block or inline tag up front. As such, by default all tags are inline except for a few key ones, such as the form tag.

The FreeMarker tags offer a consistent syntax, along with additional features and improved error management.

Next: Themes and Templates

  • No labels