Back Forward static JavaServer Page tag

JavaServer Pages tags

Use the static JSP tag to cause one or more static file bundles or individual files to be included in the current stream. A static file bundle rule identifies a list of JavaScript or 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: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.

When to use

TipFor example, when entering HTML source code directly into the HTML tab of a HTML Property 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 HTML property rules.

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.

NoteReferences 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

Advanced 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 HTML Property rules.

Definition static content
Related topics bundle JSP tag
file JSP tag
About Static File Bundle rules
More about HTML Property rules

zzzJavaServer Page tags