Back Forward save JavaServer Page tag

JavaServer Pages tags

 zzz Show all 

Use the save tag to set up named values at runtime, while the source HTML (or XML) is processed, onto an internal symbol table known as the scratchpad. This in-memory scratchpad is available throughout the generation of the HTML (or XML) stream.

 zzz Example

Use the save tag to pass values among multiple HTML definitions that stream processing combines to generate a single output stream.

For example, use the save tag to save the value "Pegasystems Inc." and store it in a scratchpad variable named company.

<pega:save name="company" value="Pegasystems Inc." />

Later in the stream, you can use the $save() function to look up the saved value on the scratchpad and display the saved value.

<pega:reference name="$save(company)" />

The save tag can save values determined dynamically at runtime. For example:

<pega:forEach name=".pxResults">
   <pega:withEmbedded name="this.address" >
        <pega:save name="currentAddress" ref="$this-value" />
     </pega:withEmbedded>
</pega:forEach>

 zzz Complete syntax

In the syntax presentations below:

<pega:save name="anyname"  
    value="value"
    append="text"
    appendRef="aref"
    prepend="text"
    prependRef="aref"
    ref="indirect reference"/>

The name attribute is required. Include either the value or ref attribute.

Attribute

Value

name A text string of your choosing, used for later retrieval. Choose a name that is unique for each save operation. (If you save using the name FUM and later save FUM again, the more recent value overwrites the earlier value.)
value Optional. A constant text string representing the value to be saved and associated with the name.
append Optional. Enter literal text to be appended after the value of the name attribute.
appendRef Optional. Enter a property reference that at runtime evaluates to text to be appended after the value of the name attribute.
prepend Optional. Enter literal text to be prepended before the value of the name attribute.
prependRef Optional. Enter a property reference that at runtime evaluates to text to be prepended before the value of the name attribute.
ref Optional. Identifies a source of text for the value, determined at runtime. See How to reference properties indirectly in JSP tags.
Definitions scratchpad, stream processing
Related topics How stream processing works

zzzJavaServer Pages tags