You are here: Reference > Streams and JSP > JavaServer Pages tags > static

static JavaServer Page tag

Use the static JSP tag to cause one or more static file bundles, individual text files, or individual binary files to be included in the current stream. A static file bundle rule identifies a list of JavaScript, image, and Cascading Style Sheet files to be sent to a browser session together in one HTTP response, to reduce HTTP traffic and improve response time to the browser user.

For example:

<pega:static type="script" app="webwb" >
     <pega:bundle name="pega_tools" />
     <pega:bundle name="acmestyles" />
     <pega:file name="markov.js" />
     <pega:binaryfile name="johnson.gif" app="webwb" />
</pega:static>

This tag references two static bundle rules pega_tools.script and Acmestyles.script, which in turn may identify multiple text file rules (Rule-File-Text rule type) containing JavaScript scripts.

The <pega:file > tag identifies a single text file rule (a JavaScript file, webwb.markov.js) to be included in the stream. Similarly, the <pega:binary tag> identifies a single binary file rule (an image) to be included in the stream.

When to use

For example, when entering HTML source code directly into the HTML tab of a control rule (or similar form), you can minimize the size of the resulting HTML document with the <pega:onlyonce >, <pega:bundle> and <pega:static > tags. See Including only one copy of JavaScript code in More About Controls.

Complete syntax

In the syntax presentation below:

<pega:static app="applicationname" type="type">
<!-- one or more pega:bundle JSP tags -->
<!-- one or more pega:file JSP tags -->
</pega:static>

The type attribute is required.

You can include a pega:when tag within the static tag scope, to conditionalize which bundles or files are included.

References to CSS files (in the form of the <link rel="stylesheet" ...> tag) must appear within the <head> element of an HTML document. In contrast, a <script ..> tag can appear anywhere in the document.

Attribute

Value

app

The first key part (Application Name Directory) of the text file rule included in the <pega:static..> tag. All files included within one <pega:static ..> tag must have a common Application Name

type

One of two values to identify the type of content in the bundle rules:

  • script — all listed bundle rules have script as the second key part
  • style — all listed bundle rules have style as the second key part
prefixURL

Reserved. Do not use.

Example

If your application includes JavaScript files, CSS files, or other static content saved in multiple text file rules that are needed together at runtime on the user workstation, group them into a bundle. For an example, see More about control rules.

JavaServer Page tags