Velocity tags are extensions of the generic Struts Tags provided by WebWorkthe framework. You can get started almost immediately by simply jump right in just by knowing the generic structure in which the tags can be accessed: #wwxxx #s*tag *(...) ... #end, where xxx tag is any of the tags supported by WebWork.
Note |
---|
As of WebWork 2.2, Velocity support in WebWork has been deprecated. Many of the new 2.2 features were not built for Velocity, and moving forward Velocity support may be removed entirely. We highly recommend you look at FreeMarker. |
Syntax
Struts Tags supported by the framework.
For example, in JSP you might create a form like so:using Struts tags.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<ww<s:form action="updatePerson"> <ww<s:textfield label="First name" name="firstName"/> <ww<s:submit value="Update"/> </wws:form> |
In Velocity, the same form is built like so:can also be built using macros.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#wwform#sform ("action=updatePerson") #wwtextfield#stextfield ("label=First name" "name="firstName") #wwsubmit#ssubmit ("value=Update") #end |
Block and Inline Tags
You may notice that some Some VM tags require an #end statement , while others do not. Due to 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. We strongly encourage you to look at FreeMarker, which provides much better flexibility in this area as well as others.