collection

Iterate over a java.util.Collection and display the selected properties of each bean in the collection

  • If the tag is nested in a form tag, it is possible to display radio buttons or checkboxes to select one or more beans.
  • It is possible to iterate on two collections at one time
  • It is possible to alternate the colors used to render a line
  • It is possible to highlight a line matching a specified property

Attributes

Attribute NameDescription
bundleBundle to use to display the messages
nameName of the first collection in the pageContext or name of the bean containing the collection. Default: the form bean name
propertyProperty of the bean 'name' giving the first collection [EL]
idId to expose the bean in the collection during the iteration process.
modelName of the model to use to render the collection. See the skin page for more information
name2Name of the second collection in the pageContext or name of the bean containing the collection.
property2Property of the bean 'name' giving the second collection
id2Id to expose the bean in the second collection during the iteration process.
indexIdThe name of the bean that will contain the index of the current bean in the collection during an iteration.
oddIdIf this attribute is set, put a boolean in the pageContext indicating if the index is odd or not.
sortPictogramThe name of the image that will be used to display the links to sort the collection
sortLabelThe alt text of the image that will be used to display the links to sort the collection
sortAction, sortParamused to set a custom sort action with specified url and parameter. Sort the collection on the client with javascript if set to "client"
styleClasscss class to use to display the collection
styleClass2When set, styleClass and styleClass2 are swapped after each iteration to allow row color alternance.
styleIdIdentifier to be assigned to the HTML generated table element.
selectIdProperty holding the id of the bean. Used with multiple selection when the form bean property is a Map.
selectIndexNested form bean property. Used whith multiple selection when the form bean property is an Array.
selectNamename of the form bean property to use to send back which bean of the collection is selected. If null, selectProperty value is used.
selectPropertyProperty of the beans to use to specify which bean is selected
selectTypeSpecify if it is possible to select a single value (radio) or multiple values (checkbox)
widthWidth of the panel used to render the collection
alignAlignment of the panel. Default is CENTER
offsetOffset of the index of the collection to start with
lengthIndex of the last item in the collection to display
offsetIndexIdName of the bean that will contain the iteration index, starting at the offset value
onRowClickJavascript code to execute when a row is clicked on [EL]
onRowDblClickJavascript code to execute when a row is doubleclicked on [EL]
onRowMouseOutJavascript code to execute when the mouse moves out of a row [EL]
onRowMouseOverJavascript code to execute when the mouse moves over a row [EL]

collectionItem

The collectionItem tag is used to specify the properties of a bean that must be displayed in a collection tag.

  • It is possible to not specify a value for the property attribute. In this case, the content of the tag will be display instead of the property value.
  • It is possible to specify the name of a formatter that will be called to format the value to display
  • It is possible to generate a link to a specified url, href of forward and automatically add a parameter
  • It is possible to sort columns
  • It is possible to compute statistics from a column.

Attributes

Attribute NameDescription
actionStruts action to use to compute the URL
arg0, arg1Optional title parametric replacement values [EL ]
filterIf set to false, do not filter sensitive HTML characters
forwardAs url, but the url is computed with the specified struts forward.
footerFooter of the column [EL]
footerArg0, footerArg1Optional title parametric replacement values [EL]
hrefAs href
mathOperationMath operation to apply to the column. Valid values are : geometricMean, max, mean, min, product, sum, sumLog, sumSq, variance
mathPatternDecimalFormat pattern to use to format the numbers
nameName of the bean containing the property to display. By default, the beans on the first collection are used.
onclickThe value of this attribute is copied to the onclick attribute of the generated hyperlink [EL]
pageAs url, but the url is computed with the specifed page.
paramIf specified, the value of the property named 'param' will be appends to the previous url.
paramIdComma separated list of parameter ids to add to the previous url.
paramNameComma separated list of parameter names to add to the previous url. This attribute is not required (the current bean from the collection is used by default).
paramPropertyComma separated list of parameter properties to use to generate the parameters for the previous url.
propertyName of the property to of the beans to display
sortableIf set to true, display a link to sort the collection by this column. The configuration of the sort action is described in the example section.
styleOverride the style class defined in the collection tag with the specified style. The style should end with ';'
styleClassOverride the style class defined in the collection tag. Not compatible with the collectionStyle tag and the use of 2 styleClasses in the collection tag
targettarget frame
titleKey of the title to display for this property [EL]
typeFormat type [EL]
urlIf specified, the property value will be rendered with an html link to this url.
widthColumn width

collectionInput

The collectionInput tag goals is to allow to edit the specified property of the beans in the current collection.

  • It is possible to not specify a value for the property attribute. In this case, the content of the tag will be display instead of the property value.
  • It is possible to specify the name of a formatter that will be called to format the value to display
  • It is possible to sort columns

Attributes

Attribute NameDescription
createFormatterstruts-layout formatter to apply on the displayed value in create mode
editFormatterstruts-layout formatter to apply on the displayed value in edit mode [EL]
formIndexname of the index variable in the pageContext. If null the current index is used.
formNamename of the form to use to send the values
formPropertyindexed property of the form to use to send the values [EL]
inspectFormatterstruts-layout formatter to apply on the displayed value in inspect mode
keyPropertyIf set, the form property must be a mapped property. The key used are the keyProperty of the beans
maxlengthMaxlength of the generated input fields
modeDisplay mode of the input fields. See the documentation of the input fields
nameName of the bean containing the property to display. By default, the beans on the first collection are used.
onchangeonchange javascript handler [EL]
policystruts-layout policy to use to restrict the display mode
propertyName of the property of the beans to display
sizeSize of the generated input fields
sortableIf set to true, display a link to sort the collection bu this column. The configuration of the sort action is described in the example section.
titleKey of the title to display for this property
tooltipKey of the tooltip to display for this property [EL]
useCollectionSelectionIf true, edit or inspect mode is choosen in function of the collection selected rows.
widthWidth of the generated input fiels

collectionStyle

The collectionStyle tag changes the styleClass of the rows matching a specified condition.

If the matchStyle and nonMatchStyle attributes are used, it is possible to nest several collectionStyle tags, and use them with row color alternance.

Attributes

Attribute NameDescription
nameName of the bean containing the property to test.
propertyName of the property to test
valueIf set, value the specified bean property must match
valueNameName of the bean containing the match value
valuePropertyThe match value property name
lessThanIf set, value the specified bean property must be less than.
greaterThanIf set, value the specified bean property must be greater than.
matchStyleClassstyleClass to use if the condition is meet
nonMatchStyleClassstyleClass to use if the condition is not meet (optionnal)
matchStylestyle to use if the condition is meet. The style must end with ';'.
nonMatchStylestyle to use if the condition is not meet (optionnal). The style must end with '.'

pager

the pager limits the number of items printed at a time

The pager tag can be use to display a collection on several pages when there is a large number of items in the collection. The <layout:collection> tag must be nested in the <layout:pager> tag, and the sort action must be configured for the pager tag to work.

The pager uses the following keys in the skin properties file

  • layout.pager.previous.label (text to display for the previous button)
  • layout.pager.next.label (text to display for the next button)
  • layout.pager.previous.img (image to display for the previous button, can be null)
  • layout.pager.next.img (image to display for the next button, can be null)

Attributes

Attribute NameDescription
linksLocationLocation of the pager links. Allowed values are "top", "bottom" (default) and "both"
maxPageItemsMax number of items per page (a default value can be set in the skin configuration file) [EL]
sessionPagerId Name of the session attribute that holds the number of the initial page to display (the attribute must be a String). When the user navigates in the pages, the attribute is updated automatically. If this attribute is not set, the first page is displayed initially.
styleClassstyle class of the pager links
widthWidth of the pager links cell

pagerStatus

pagerStatus - display the status of the pager

The pagerStatus tag displays additional information on the pager status. It must be nested in a pager tag and put after the collection tag.

The following parameters can be inserted into the message:

  • {0} : the current page number
  • {1} : the total number of page
  • {2} : the total number of items
  • {3} : the number of the first displayed item
  • {4} : the number of the last displayed item

The default message is {0}/{1}.

Attributes

Attribute NameDescription
keyKey of the message status to display
styleClassstyle class of the pager status message
widthoptional width of the message

swap

swap : Move rows between two tables

The swap tag includes the javascript code and display the buttons that are required to move rows between two tables. An hidden select box is automatically updated so that it is possible to know which rows have been swapped

Attributes

Attribute NameDescription
propertycomma separated list of bean properties to use to indicate which ones are in which lists
formPropertycomma separated list of indexed form properties to use
selectedStyleClassstyle class of the selected rows

nestedCollection

nestedCollection : Iterate over nested collection

The nestedCollection tag allows to iterate over nested collection. For example, it can display the list of cars of a list of user. nestedCollection is not compatible with Javascript sort. Server side sort allows to sort the main columns.

Attributes

Attribute NameDescription
namename of the bean holding the nested collection. Default is the current bean
propertyproperty of the bean giving the nested collection
idId to expose the bean in the collection during the iteration process.
indexIdindexId to expose the bean in the collection during the iteration process.

nestedTreeCollection

Tag allowing nested collection display

Same behavior as the nestedCollection tag with a tree displat

Attributes

Attribute NameDescription
namename of the bean holding the nested collection. Default is the current bean
propertyproperty of the bean giving the nested collection
idId to expose the bean in the collection during the iteration process.
indexIdindexId to expose the bean in the collection during the iteration process.
labelPropertyProperty to display as node value.

collectionDetail

collectionDetail : Defines a property to be displayed as a detail.

The collectionDetail tag allows to specify the properties that will be displayed as details.

Detail properties are not displayed in a column, but in a text field under the collection.

When the user moves the mouse over a row, the detail fields are updated with the data of the selected row.

The <layout:detail> tag must be used to specify where the detail must be displayed.

The id and indexId attributes of the collection tag must be set.

Attributes

Attribute NameDescription
propertyproperty to display as a detail

collectionTitle

collectionTitle : Defines a title for several columns

The collectionTitle tag allows to span a title for several columns, and to create different title lines

A title defines with a collectionTitle tag applies to the columns nested into the collectionTitle tag. A collectionTitle tag can contain other collectionTitle tag, or collectionItem and collectionInput tags.

Attributes

Attribute nameDescription
titleKey of the title to display
arg0Message parameter
arg2Message parameter
tooltipKey of the title tooltip to display
styleClassTitle style class

collectionGroup

This tag allows to add visual grouping of lines which share a common value for a specific property.

Attributes

Attribute nameDescription
propertyName of the group property (EL)
typeName of the format
actionAction (EL)
hrefKeyOpen flag
open

css

The following styles are used by the collection tag:

  • TH.myStyle : header
  • TH.myStyle TR TD : header of sortable columns
  • >
  • TD.myStyle : cells

where myStyle is the value of the styleClass attribute.