2

I posted this to the PrimeFaces user forum but I think they are too busy to look into it, so I thought I would try here.

I have server-side string that has markup in it, so when I want it rendered I do this:

            <p:panel>                    
                <f:verbatim>
                    #{daBean.markedUpString}
                </f:verbatim>
            </p:panel>

This works fine, but not if the same tag is used inside a p:dataTable -- either with or without the p:panel enclosure. What gets rendered is a div class="ui-dt-c" element with nothing in it. To test, if I take out the f:verbatim tag the marked-up text gets escaped and rendered.

I don't know if this should be considered a bug or not, but does anyone know of a work-around for this? This is with PrimeFaces 3.0.M3.

AlanObject
  • 9,613
  • 19
  • 86
  • 142

1 Answers1

6

The <f:verbatim> tag is intented to hold plain text/HTML, not JSF components nor EL expressions. The tag is a leftover from JSF 1.0/1.1 ages when it was not possible to inline plain text/HTML between JSF components. The tag is deprecated in JSF2. You do not need it anymore.

Your concrete functional requirement is thus displaying some HTML string from a managed bean unescaped. For that you should use <h:outputText> with escape="false".

<h:outputText value="#{daBean.markedUpString}" escape="false" />

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555