Introducing JavaServer Page tags
The help system documents each JavaServer Page tag for reference. However, for highest quality and security, minimize the use of hand-crafted stream rules (such as HTML rules, XML rules, HTML fragments, and non-autogenerated sections) you create in application RuleSets.
While hand-crafted, non-auto-generated rules are sometimes necessary for specific features, use of auto-generated sections in flow actions and harnesses is preferable when possible. Auto-generated rules may often provide better performance, greater security, greater levels of browser independence, and more consistent branding and styles than hand-crafted rules. If your application RuleSets contain HTML rules, use the Guardrails landing page to assess guardrail compliance, and use the Rule Security Analyzer to check for security vulnerabilities.
The JSP tag library contains about twenty tags. You can use these tags in all stream rule types, including correspondence, XML Stream rules, and user interface rules.
Syntax basics
JavaServer Page tags are well-formed XML elements. Close each tag with a corresponding, correctly nested close tag (/). For example:
<pega:choose><!-- additional HTML, XML, and JSP tags here --></pega:choose>
Some tags can be self-closing, for example:
<pega:reference name=".pyIndex" />
Each tag in the tag library begins with the pega:
prefix, except for the
r tag, which begins with a p: prefix.
To work with | Use these tags |
---|---|
Properties | Use these tags to work with properties.
|
HTML fragments or other HTML rules | Use the include tag and the onlyonce tag. |
Anchors, FORM tags, and SUBMIT buttons | Consider the url tag. |
Conditional processing | Use the when tag and the choose tag. |
Iteration and looping | Use the forEach tag. |
Output of a list view rule | Use the listView tag. |
Static file bundles | Use the static tag, which can contain bundle, binaryfile, and file tags. |
Drop-down lists for a text box value in a form | Use the autoComplete tag, which contains an acDataSource tag and may contain dsFields and dsField tags. |
Static images | Use the contentURL tag. |
Inline Java
Use the normal brackets <% and %> to enclose one or more executable Java statements (a scriptlet) within a JSP stream:
<p>So he said to me <% if(!hasError) {try .... } catch (Exception e) { ..} %> is great.
Use the <%= and %> brackets when calling a function or returning a value such as a string to be inserted into the stream:
<p>Your last payment is due on <%= payoffdate(360, mon).toString() %>.
Comments
Within a JSP tag, you can use the standard JSP comment delimiters <%--
and --%>
to mark material that is to be ignored as a comment.
Similarly, JSP tags within the Java <%
and %>
delimiters or <%=
and =%>
delimiters is ignored
during JSP processing.