Back Forward include JavaServer Page tag

JavaServer Pages tags

 zzz Show all 

Use the include JSP tag to instruct stream processing to insert one stream within the current stream. This tag lets you define a commonly used segment of HTML or XML text in one rule instance and then incorporate the text where needed.

 zzz Introduction

This tag is useful in source HTML text for user interface forms, in source HTML text for correspondence, and in XML text for interfaces.

Use the include tag to include any of nine rule types:

For example, this code inserts a fragment of HTML text into the currently processed stream:

<pega:include name="NewHeader"  type="Rule-HTML-Fragment" />

NoteThe name attribute identifies only the final key part or key parts of the target rule to be included. For rule types that contain an Applies To key part, the system uses the Applies To key part of the current rule at runtime and uses rule resolution to find the target rule to include.

Notepega:include JSP tags can also appear in rules of other types derived from the Rule-Stream class, such as harness, section, flow action, list view and summary view rules. In most cases, the HTML code and JSP tags for these rules are automatically generated.

NoteDon't use this tag to include a rule within itself (recursion), as that often causes an infinite loop.

 zzz Complete syntax

In the following syntax presentation:

<pega:include
     [name="name"] 
     [ref="indirect reference "] 
     [type="rule type"]
     [inline="true"|"false" ]
/>

Either name or ref is required as an attribute.

Attribute

Description

name

The name — second key part — of the rule to included. Use this attribute when the name is known during design.

ref

Used for indirect references, which allow the rule name to be determined dynamically at runtime. See How to reference properties indirectly in JSP tags

type

Optional. Identify the class of the rule to be included, for example Rule-Obj-HTML, Rule-HTML-Property, or Rule-HTML-Section.

If the type attribute is omitted, then the type that is included depends on the including type, as follows:

  • A Rule-Obj-HTML or Rule-HTML-Fragment includes a Rule-HTML-Fragment.
  • A Rule-HTML-Property includes a Rule-HTML-Property.
  • A Rule-Obj-XML includes a Rule-Obj-XML.
  • A Rule-Obj-Corr or a Rule-Corr-Fragment includes a Rule-Corr-Fragment.

You can use any of these keywords:

  • standard — Type to be included is the same as the including type, except that a Rule-Corr-Fragment rule includes a Rule-Obj-Corr rule, and a Rule-HTML-Fragment or Rule-HTML-Property rule includes a Rule-Obj-HTML.
  • property — Short for Rule-HTML-Property.
  • fragment — Short for Rule-HTML-Fragment.
  • noinput — Display the included HTML text as read-only. Type be include is the same as the including type, except that a Rule-Corr-Fragment rule includes a Rule-Obj-Corr rule, and a Rule-HTML-Fragment or Rule-HTML-Property rule includes a Rule-Obj-HTML.

NoteYou can't include a Rule-HTML-Fragment rule or Rule-Obj-Corr rule within an XML Stream rule.

NoteYou can include a Rule-HTML-Property rule only within a Rule-Obj-Corr rule.

inline

AdvancedOptional. Set to "false" in unusual situations to disable the default Java generation approach, which inlines Java code for this tag. The "false" setting may reduce the size of the Java class generated for the stream rule, possibly allowing it to fit within the 64KB limit.

The default value is "true"; inlining is preferred as it normally provides better performance.

 zzz Three special cases — XML, Correspondence, and Correspondence Fragments

Three stream rule types have three key parts. If the stream rule class is Rule-Obj-Corr or Rule-Corr-Fragment, identify the second and third key parts in the value of the name attribute, separated by a period. The third key part is the Correspondence Type.

For example, the standard correspondence type Email can appear:

<pega:include name="SuccessCorr.Email"  type="Rule-Obj-Corr"/>

Similarly, you can include a correspondence fragment for phone text:

<pega:include name="WorkDetail.PhoneText" type="Rule-Corr-Fragment"/>

Likewise, if the stream rule class is Rule-Obj-XML, use a period to separate the second and third key parts of the target XML Stream rule. For example:

<pega:include name="Contact.MapFrom" type="Rule-Obj-XML" />

 zzz Including sections that accept parameters

A section rule may accept parameters, identified on the Params tab of the Section form. If the <pega:include > tag is for a section, you can use the <pega:params > JSP tag to supply parameter values.

For example:

<pega:include name=".GameResults" type="Rule-HTML-Section" >
   <pega:param name="HomeTeam" value="Boston"/>
   <pega:param name="VisitorTeam" value="Yankees" />
   <pega:param name="HomeTeamRuns" value="3" />
   <pega:param name="VisitorTeamRuns" value="7" />
</pega:include>

Definitions Harness form, fragment, stream processing

zzzJavaServer Pages tags