Converting from directives to JavaServer Page tags

Pega Platform provides automated conversion facilities that translate most directives into equivalent JSP tags.

Use of JSP tags rather than directives is recommended for new applications and upgraded older applications. Use of JSP tags is required for applications which are to be localized.


Use of JSP tags rather than directives offers these benefits:

  • Processing is more efficient.
  • Developers familiar with JSP technology are immediately productive
  • Your application can incorporate JSP tag libraries (taglibs) already developed or acquired from other parties.
  • Properties and pages named in the XML or HTML code are validated as you save the rule.
  • The Referencing Rules display for properties includes the JSP-style stream rules that reference the property. (In contrast, such information is less complete for directive-based stream rules.)

To simplify this transition, your application can use directives in some stream rule instances and JSP tags in others. (Don't attempt to use both forms in a single rule.)

In many cases, you can use the automated conversion described here to convert directives to the equivalent JSP tag forms. If you can save the JSP-converted form of the rule without errors, the updated rule operates identically to the original directive-based version.


These instructions apply to these rule types, which are derived from the Rule-Stream class:

  • Rule-HTML-Fragment
  • Rule-Obj-HTML
  • Rule-Obj-XML

To update a rule containing directives to contain equivalent JSP tags:

  1. Open the rule.
  2. Use the Save As toolbar button to make a new copy in another RuleSet, or in the same RuleSet with a higher version number.
  3. Confirm that the Generate As field is set to HTML.
  4. The Convert to JSP button appears. Click the button.
  5. The Pega Platform parses the HTML or XML text and automatically replaces the directives with equivalent JavaServer Page tags. It changes the Generate As field value to JSP.
  6. Click the Save toolbar button. The Pega Platform checks the rule for these conditions:
    • Basic syntax, such as matching quotes, matching parentheses and matching <> pairs
    • Pages referenced in the text also appear on the Pages & Classes tab
    • Properties referenced in the text are defined
    • Other stream rules referenced in the text are defined
    • JSP tags are well-formed XML elements, with quotes around all attribute values.
  7. Respond to any errors reported by updating the Pages & Classes tab, information on other tabs, or the HTML or XML source code as appropriate, and save again.

Restrictions and notes

Certain constructs and Version 02-02 PublicAPI calls are not permitted in stream rules that depend on JavaServer Page tags. These conditions are detected and reported as errors when you attempt to save the rule.

  1. A JSP tag cannot reference a rule that does not yet exist or is in a RuleSet or Version not on your RuleSet list. (You can reference a rule that exists but is marked as unavailable.)
  2. Page names appearing in the HTML or XML text must also appear on the Pages & Classes tab.
  3. Some Version 02-02 PublicAPI methods including the following are not supported. These are rare.
    • thisRefPush()
    • thisRef() — use tools.getActive()
    • targetPush()
    • inputPermitted()
    • getOpposit()
    • getIdent()
    • forEachPageInList()
    • basePagePush()
    • basePage()
    • appendLookup()
  4. In the attributes of the <pega:when > tag, you cannot reference both a JavaScript and another when tag option (such as a when condition rule or the $mode-input option). Also, complex expressions that use the two Java operators || and && may fail to convert or operate correctly at runtime.
  5. A circumstance-qualified or time-qualified rule derived from the Rule-Stream class (for example, control rules) and the corresponding base rule must both use JSP tags, or both use directives. If you convert a rule that is a base rule for qualified rules, convert all the qualified rules also.

About JavaServer Page tags