You are here: Reference > Rule types > HTML Fragment rules > HTML Fragment form - Completing the HTML tab

HTML Fragment form
Completing the HTML tab

  1. About 
  2. New 
  3. HTML 
  4. Pages & Classes 
  5. History 
  6. More... 

You can enter the HTML, JavaScript, or Cascading Style Sheet code directly into the HTML Source text area.

Use the literal directive around any curly brace characters in JavaScript or Cascading Style Sheet text.



Omit extra Spaces?

Select to eliminate extra space characters in the processed HTML. This can make transmission or processing more efficient. It does not alter the appearance of the HTML when displayed in a browser.

When selected, the way the system handles stream processing is different for JavaServer Pages (JSP) streams and HTML streams.

JSP streams replace consecutive spaces and control characters with a single space. For example: << space >><< new line >><<tab>> is converted to << space >>. Two or more consecutive space characters are replaced with a single space, except within the curly brace characters defining directives.

As a best practice, remove all line breaks and whitespace. For example:



Some Value




<pega:choose><pega:otherwise>Some Value</pega:otherwise></pega:choose>

HTML streams delete control characters appearing at the beginning of the rule definition and immediately after a directive, but otherwise behave like JSP streams. For example:

<< tab >>{some directive}<< tab >><< space >><< tab >>{some directive}<< space >><< space >>

is converted to:

{some directive}<< space >>{some directive}<< space >>

HTML stream processing copies space characters within the text of a property value and non-breaking spaces (&NBSP;) into the processed HTML without change.

Generate For

This field and the Convert to JSP button display only when the rule contains HTML directive rather than JSP tags. The value that displays is HTML.

As a best practice, use JSP tags rather than directives. In most cases, you can convert HTML fragments that use directives to use JSP tags automatically, using the button. See Converting from directives to JavaServer Pages tags.

Do not save the rule form when the source contains both JSP tags and directives.

If this rule is circumstance-qualified or time-qualified, make this Generate For value match the Generate For value of the base rule. The base rule and the qualified rules must all use JSP tags or all use directives.

HTML Source

Enter the HTML, script, or CSS text. The text may include directives or JSP tags, but not both. Update the Pages & Classes tab to include each page name referenced in the HTML code, with the corresponding class.

Although HTML fragment rules do not have an Applies To key part, you can identify the class of a primary page on the Pages & Classes tab, leaving the Page Name field blank. After you update the Pages & Classes tab, you can reference properties on this page without identifying the page name.

Use of JSP tags in HTML fragment rules offers superior performance and other advantages over directives. Although both directives and JSP tags are supported, JSP tags are recommended for new development. Conversion of existing HTML fragment rules that use directives to functionally equivalent rules that use JSP tags is straightforward.

Convert to JSP

This button displays only after you save the form when the Generate For value is HTML and this rule is created by a Save As operation.See Converting from directives to JavaServer Pages tags.