Table of Contents


Use mode="literal" in the JSP tag pega:reference to eliminate leading and trailing spaces


A developer asks: Our application writes the result of an XML rule to a property value using the Property-Set-XML method. 

The result contains the correct property value, but with two leading and trailing spaces around each value. 

What causes these leading and trailing spaces, and what can we do about them?


Suggested Approach

Like HTML rules, XML rules are processed by stream processing. By default during stream processing, property references are padded with a single space before and after the value. 

To eliminate this padding, specify a mode of LITERAL in the reference directive:

{.myproperty literal}

In the JSP reference tag, specify this in the mode attribute.

<pega: reference name="myproperty" mode="literal" />

This works for XML, HTML rendered in a form, and HTML sent out as email or Word correspondence.



Published September 7, 2005 — Updated November 15, 2015

100% found this useful

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.