Patrick Dezenzio
Patrick Dezenzio

Reputation: 27

How do I convert data in text fields into formatted html?

I have a database column that contains the following:

    <p><span style="color: #ff0000"><strong>$9,500,000.00</strong></span></p>
    <p>$11,000,000.00</p>

In JSF 1.2 and Icefaces 1.8.2, this data would output fine. Under JSF 2.1 and Icefaces 3.0, I get what you see - just plain text.

Here's a snippet of code and the value is in the amount field:

        <ice:column>
            <f:facet name="header">
                <ice:outputText value="Amount"/>
            </f:facet>
            <ice:outputText value="#{offDoc.amount}"/>
        </ice:column>

I tried to wrap the ice:outputText tag with a tag but it didn't work. Any ideas?

Upvotes: 1

Views: 845

Answers (1)

Marc
Marc

Reputation: 11633

You need something like this to turn off HTML escaping:

<ice:outputText value="#{offDoc.amount}" escape="false"/>

See here: http://res.icesoft.org/docs/latest/tld/ice/outputText.html

If the "escape" attribute is not present, or it is present and its value is "true" all angle brackets should be converted to the ampersand xx semicolon syntax when rendering the value of the "value" attribute as the value of the component. If the "escape" attribute is present and is "false" the value of the component should be rendered as text without escaping.

Upvotes: 1

Related Questions