save JavaServer Page tag |
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.
Use the save JSP tag to add a name-value pair to the scratchpad. Use the $save( name) JavaScript function to retrieve the value previously associated with the name. Retrieving the value does not remove it from the scratchpad.
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>
In the syntax presentations below:
[
and ]
define optional parts of the tag. Do not type the brackets./
> mark the start and end of the tag.<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. |
scratchpad, stream processing | |
How stream processing works |