Converting from directives to JavaServer Pages tags

Pega Platform provides automated conversion facilities that translate most directives into equivalent JavaServer Pages (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.

Benefits

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. (Do not 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.

Procedure

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 displays. Click the button.
  5. Pega Platform parses the HTML or XML text and automatically replaces the directives with equivalent JSP tags. It changes the Generate As field value to JSP. 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 JSP 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 that display in the HTML or XML text must also display 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 Pages tags