You are here: Reference > Streams and JSP > Converting from Directives to JSP Tags

Converting from directives to JavaServer Pages tags

Pega 7 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:

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:

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

  1. Open the rule.
  2. Use the Save As toolbar button (Save As) 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 7 parses the HTML or XML text and automatically replaces the directives with equivalent JSP tags. It changes the Generate As field value to JSP.
  6. Click the Save toolbar button (). Pega 7 checks the rule for these conditions:
  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 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.

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.

Definitions About JavaServer Pages tags
Related topics How to complete a Pages & Classes tab

JavaServer Pages tagsAbout JavaServer Pages tags