Tags

This section describes the attributes of the struts-layout tags.

Input fields :

<layout:field>

<layout:text>

<layout:number>

<layout:textarea>

<layout:checkbox>

<layout:password>

<layout:file>

<layout:date>

<layout:select>

<layout:radio>

<layout:radios>

<layout:checkboxes>

<layout:option> <layout:options>

<layout:optionsCollection>

<layout:optionsDependent>

<layout:detail>

<layout:suggest>

<layout:fieldArea>
Submit buttons :

<layout:formActions>

<layout:submit>

<layout:cancel>

<layout:reset>

<layout:image>

<layout:button>
Layout :

<layout:grid>

<layout:column>

<layout:row>

<layout:line>

<layout:space>

<layout:cell>

<layout:write>

<layout:message>

<layout:link>

<layout:skin>

<layout:mode>

<layout:notMode>

<layout:policy>

<layout:img>
Collection display :

<layout:collection>

<layout:news>

<layout:collectionItem>

<layout:collectionInput>

<layout:collectionStyle>

<layout:pager>

<layout:pagerStatus>

<layout:swap>

<layout:nestedCollection>

<layout:nestedTreeCollection>

<layout:collectionDetail>

<layout:collectionTitle>

<layout:collectionGroup>

<layout:table>
Panel / Container :

<layout:html>

<layout:panel>

<layout:form>

<layout:tabs>

<layout:tab>

<layout:popup>

<layout:toolbar> (no default renderer yet)
Datagrid :

<layout:datagrid>

<layout:datagridColumn>

<layout:datagridSelect>

<layout:datagridCheckbox>

<layout:datagridText>
Menu :

<layout:menuItem>

<layout:menuAction>

<layout:menu>

<layout:dynMenu>

<layout:treeview>
Breadcrumbs :

<layout:crumbs>

<layout:crumb>

Wizard :

<layout:wizard>

<layout:wizardStep>

JSTL expression evaluation

Some tag properties can be simple JSTL expressions, like ${beanName.beanProperty}. Those properties are indicated with "[EL]".

Library initialization

Note about library initialization

Submit buttons

formActions

Used inside a <layout:form> tag to include struts-layout tags or buttons

Can automatically generate save/reset/cancel or confirm/cancel button if values are specified for the attribute name & property.

Attributes:

Attribute NameDescription
alignAlign attribute of the column generated. Default: CENTER

submit

Render a submit button.

Differs from the one in the html taglib by the addition of an attribute to specify the action value of a DispatchAction. This allows the form to have many submit ot cancel buttons calling different methods of a DispatchAction. The submit button can also been displayed in function of the form display mode.

Additional attribute:

Attribute NameDescription
modeMode in which the button must be displayed. Format: "X,Y,Z" where X Y Z can be "D" (display), "N" (not displayed) "C" (Cell, the button is replaced by an empty space) or "F" (frozen, set disabled HTML attribute) in the create, edit and inspect form mode [EL]
policyName of the display policy to use
reqCodevalue of the action parameter for the action subclassing DispatchAction
selectCodeset the value of the parameter 'selectCode' of the form to the value of the 'selectProperty' property of the bean under the name 'selectName' when the form is submitted.
selectNamecf selectcode
selectPropertycf selectCode

cancel

Render a cancel button.

Differs from the one in the html taglib by the addition of an attribute to specify the action value of a DispatchAction. This allows the form to have many submit ot cancel buttons calling different methods of a DispatchAction.

Additional attribute:

Attribute NameDescription
reqCodevalue of the action parameter for the action subclassing DispatchAction
modeMode in which the button must be displayed. Format: "X,Y,Z" where X Y Z can be "D" (display), "N" (not displayed) "C" (Cell, the button is replaced by an empty space) or "F" (frozen, set disabled HTML attribute) in the create, edit and inspect form mode [EL]
policyButton display policy

reset

Render a reset button.

Additional attribute:

Attribute NameDescription
modeMode in which the button must be displayed. Format: "X,Y,Z" where X Y Z can be "D" (display), "N" (not displayed) "C" (Cell, the button is replaced by an empty space) or "F" (frozen, set disabled HTML attribute) in the create, edit and inspect form mode [EL]
policyButton display policy

image

Render an image button.

Differs from the one in the html taglib by the addition of an attribute to specify the action value of a DispatchAction. This allows to have many submit ot cancel buttons calling different methods of a DispatchAction.

Additional attribute:

Attribute NameDescription
modeMode in which the button must be displayed. Format: "X,Y,Z" where X Y Z can be "D" (display), "N" (not displayed) "C" (Cell, the button is replaced by an empty space) or "F" (frozen, set disabled HTML attribute) in the create, edit and inspect form mode [EL]
nameName of the image in the struts-layout image directory
policyButton display policy
reqCodevalue of the action parameter for the action subclassing DispatchAction

button

Render a button

Attributes:

Attribute NameDescription
accesskey-
modeMode in which the button must be displayed. Format: "X,Y,Z" where X Y Z can be "D" (display), "N" (not displayed) "C" (Cell, the button is replaced by an empty space) or "F" (frozen, set disabled HTML attribute) in the create, edit and inspect form mode [EL]
onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup-
policyButton display policy to use
property-
reqCodevalue of the action parameter for the action subclassing DispatchAction
style-
styleClass-
tabindex-
valign-
value-

Layout

write

Modified <bean:write> which allows a field to be formatted with the displayed value. The tag can be nested in a layout tag (panel, form frid etc.)

Attributes:

Attribute NameDescription
filterFilter sensitive HTML characters (default : true)
layoutif set to false, do not surround the value with html layout code(<th>).
nameAs in <bean:write> [EL]
propertyAs in <bean:write> [EL]
typeFormat type
stylecss style to use to display the value
styleClasscss style class to use to display the value

message

Modified <bean:message> tag that can be nested in a layout tag (panel, form, grid etc.)

Additional Attributes:

Attribute NameDescription
styleClasscss style to use to display the message

link

Modified <html:link> tag that can be nested in a layout tag (panel, form, grid etc.). The tag also generates the required javascript code if struts-layout is configured to warn when the user clicks on a link and have unsaved form changes.

Attribute NameDescription
actionLink action
hrefLink href [EL]
layoutIf set to false, do not generate layout code
modeLink display mode
policyLink display policy
schemeGenerate an absolute URL with the specified scheme (http/https) [EL]
titleThe advisory title for this hyperlink.
titleKeyThe message resources key for the advisory title for this element.

skin

Insert a link to the stylesheet set by LayoutUtils.setSkin(...). If no skin has been set, the default skin specified in Struts-Layout.properties is used.

Attribute NameDescription
includeScriptIf set to true, include the struts-layout javascript files

mode

Include the body of the tag only if the current form display mode matches one indicating in the value attribute.

Attribute NameDescription
valuecomma separated list of allowed mode. Ex "create,edit" or only "inspect"

notMode

Include the body of the tag only if the current form display mode does not match the specified mode

Attribute NameDescription
valueForm display mode to not match (allowed values: "create", "edit" and "inspect")

policy

Include the body of the tag only if the specified policy returns MODE_EDIT

Attribute NameDescription
policyPolicy to use to check if the body content shoud be evaluated
propertyThe policy property parameter

List

news - Render a collection

Deprecated. Render the selected properties of each member of a collection, using one panel per member. Attributes are the same as for the collection tag.

table - Iterate over a collection and display the tag body content in a table which columns number can be specify

The table tag displays each item of a collection in a table whose number of columns is fixed by the developer.

Attribute NameDescription
nameName of a bean in the context containing the collection
propertyIf the bean is not the collection itselft, name of property which will give the collection
idName to use to expose the beans in the collection
indexIdName to use to expose the iteration index
colThe number of columns of the table
widthThe width of the table
alignThe alignment of the table

html

Render the following Html tags: <html>, <head>, <title>, <base> and <body>. The tag includes the struts-layout javascript files and the css file. See LayoutUtils.setSkin(HttpSession, String) to change the css file to use. If this tag is not used, the <layout:skin> tag must be used to include the javascript and the css.

The following tags can be put in the body of this tag: form, collection, news

Additional attributes:

Attribute NameDescription
aligncontent align (default : center)
keyKey of the message to use as the page title
layoutgenerate html layout code (default: true)
onloadbody onload event handler
styleClasscss class to use to display this page

Note about servlet context attributes

The following servlet context attribute can be set:

  • struts-layout-old-panel-nesting

    The HTML code generated has change in struts-layout 0.5 so that panels and collections can be nested without having to add HTML code between the tags. If set to "false" this attribute will keep the old behaviour.
  • Undocumented attributes

    There are other undocumented attributes that an be used to preserve compatibilty with old version. They can be found in the fr.improve.struts.taglib.layout.util.LayoutUtils class.

Library initialization

If one of the previous attributes are set, the library should be initialized by a call to fr.improve.struts.taglib.layout.util.LayoutUtils.init(ServletContext). It is recommended that this be added in the servlet init method.