Struts 2 > Velocity Tags - Old |

Struts 2
Velocity Tags - Old
Edit Page Browse Space Add Page Add News
Added by mnrsiat, last edited by Ted Husted on Sep 02, 2006 (view change)

[Note: this page is being actively worked on as of June 15 2005. I'll remove this notice when it's complete enough to be depended on.]

WebWork's Velocity tags correspond nearly exactly to the JSP Tags. The syntax is, of course, very different, but the functionality is the same. This page is a reference for the Velocity syntax, but does not attempt to discuss the functionality in any detail. If you are unfamiliar with the tags, please read the JSP Tags page first for a solid discussion of the available features.

Much of this information is available elsewhere on the wiki, but it is all mixed in with the JSP discussion and not well labelled.

Name | Tag | Description
--- | --- | ---
Checkbox tag | #tag( Checkbox ) | render a checkbox input field
Checkboxlist tag | #tag( Checkboxlist ) | render a list of checkboxes
Combobox tag | #tag( ComboBox ) | widget that fills a text box from a select
Component tag | #tag( Component ) OR #bodytag( Component ) #end | render a custom ui widget
File tag | #tag( File ) | renders a file select input field
Form tag | #bodytag( Form ) #end | defines an input form
Hidden tag | #tag( Hidden ) | render a hidden field
Label tag | #tag( Label ) | render a label that displays read-only information
Password tag | #tag( Password ) | render a password input field
Radio tag | #tag( Radio ) | renders a radio button input field
Select tag | #tag( Select ) | renders a select element
Submit tag | #tag( Submit ) | renders a submit button
Table tag | #tag( Table ) OR #bodytag( Table) #end | renders a table
Tabbedpane tag | #tag( Tabbedpane ) | renders a tabbedpane
Textarea tag | #tag( Textarea ) | renders a text area input field
Textfield tag | #tag( TextField ) | renders an input field of type text
Token tag | #tag( Token ) | stop double-submission of forms

You'll notice that some of the tags use a #tag( Name ) syntax, and others use a #bodytag( Name ) #end syntax. Tags that are parameterizable must use the second, which allows for body content. In general, the syntax is:

    #bodytag( Name )
          #param( "name" "value" )
      #end