Skip to main content
Skip table of contents

addItem

Adds an item to a Collection. This new item will become the last item of the Collection.

Parent commands

  • setCollection
    Optional. If placed as a child of setCollection, the collection attribute may be left undefined to have the parent command's new Collection receive the item.

Attributes

value

Required

Value type

EL-evaluated

Yes

Any

Yes

The resolved value of this attribute is the new item for the Collection.

collection

Required

Value type

EL-evaluated

No

Collection

Yes

Defines the Collection into which the new item is added.

If this attribute is undefined and this command is a child of setCollection, the item is added into that newly created Collection. Leaving this attribute undefined if this command is not a child of setCollection is considered an error.

Examples

Using addItem as a child of setCollection causes the item to be added into the newly created Collection. Use this way to initialize fresh Collections with content.

CODE
<setCollection var="items"><addItem value="${item}">

If adding an item to an already existing Collection, the collection attribute needs to be defined.

CODE
<setCollection var="items">...<addItem value="${item}" collection="${items}">
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.