Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

save JavaServer Page tag

Updated on August 10, 2022

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.

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>

Complete syntax

In the syntax presentations below:

  • Square bracket characters [ and ] define optional parts of the tag. Do not type the brackets.
  • JSP tag delimiters <pega and / > mark the start and end of the tag.
  • Replace any text in italics with your choice of value of that type.
<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.

AttributeValue
nameA 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.)
valueOptional. 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.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us