Skip to main content

contentURL JavaServer Page tag

Suggest edit
Updated on March 16, 2022

Use the contentURL JSP tag to include a system-generated cleartext URL in the current stream that requests an image saved in an image content data instance ( Data-Content-Image class). This is a reusable, unhashed URL that can be used more than once to refer to the image.

For example:

<img src='<pega:contentURL name="filename.fileType" path="/filePath/" classType="Image" />' >

Generates the following cleartext URL:

<img src=’../datacontent/Image/filePath/fileName.fileType’>

An image retrieved from an Image Content instance is the same for all requestors.

Example

For an example, review the standard HTML rule @baseclass.Operator-Profile-Full. This rule supports the display of operator images in the ViewMy Profile display. If an image content data instance for an operator is associated with an operator ID, that file is retrieved and included in the My Profile display. If no data content data instance is associated with the operator ID, the default image from the binary file rule image.dialogprofileimage.gif appears.

Complete syntax

In the syntax presentation below:

  • JSP delimiters <pega:...> and </pega:...> mark the start and end of the tag.
  • Replace any text in italics with your choice of value of that type.
  • Square brackets [ ] surround optional attributes.
<pega:contentURL name="filename.filetype"
	[path="filepath" ]
		classType = "Image"
	[ enforceAbsoluteURL = "true|false" ]
/>

The name and classType attributes are required.

AttributeValue
name Second key part ( File Name ) and third key part ( File Type ) of an image content data instance.
path First key part ( File Path ) of an image content instance. Note that each path value starts and ends with a forward slash character. If the path is blank, this attribute can be omitted.
classType"Image" is the only allowed value. .
enforceAbsoluteURL Optional (only necessary for unusual situations). An absolute URL may be needed in unusual situations where the base URL of the HTML page containing the tag differs from typical structure. Set to " true " to generate an absolute HTTP URL. For example:
<img src='<pega:contentURL name="filename.fileType" path="/filePath/" classType="Image" />' >

Will result in:

<img src=’http://myserver:8080/prweb/datacontent/Image/filePath/fileName.fileType’>

If false, the system generates a relative URL. The default if this attribute omitted is "false".

Note: The contentURL tag generates a URL, not an <img ..> tag. To present an image, include the contentURL within an <img > tag, as shown above.

JavaServer Page tags

Did you find this content helpful? YesNo

Have a question? Get answers now.

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

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