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.
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.
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:
- Open the rule.
- Use the Save As toolbar button to make a new copy in another ruleset, or in the same ruleset with a higher version number.
- Confirm that the Generate As field is set to
- The Convert to JSP button displays. Click the button.
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.
- 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.)
- Page names that display in the HTML or XML text must also display on the Pages & Classes tab.
- Some Version 02-02 PublicAPI methods including the following are not supported. These
- thisRef() — use tools.getActive()
and another when tag option (such as a when condition rule or the
$mode-inputoption). Also, complex expressions that use the two Java operators
&&may fail to convert or operate correctly at runtime.
- 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.
Previous topic Parse Normalize rules - Completing the Create, Save As, or Specialization form Next topic Toggling features on and off