How to display html content in a dataTable

0

I have the message field in an Editor that after inclusion is shown in a dataTable.

<rich:editor value="#{solicitacaoImpressaoBean.solicitacao.mensagem}" toolbar="full"  style="margin-bottom: 1em">

DataTable:

<rich:dataTable id="tabelaSolicitacoes" value="#{solicitacaoImpressaoBean.peg.solicitacoes}" var="solicitacao"
            iterationStatusVar="it" rowClasses="linhaPar, linhaImpar"
            style="width: 100%;"
            >

            <rich:column style="text-align: center;">
                <f:facet name="header">Data</f:facet>
            <h:outputText value="#{solicitacao.dataEnvio}" converter="dataHoraConverter"  />
            </rich:column>

            <rich:column style="text-align: center;">
                <f:facet name="header">Siape do Cadastrador</f:facet>
            <h:outputText value="#{solicitacao.siapeCadastrador.siape}" />
            </rich:column>

            <rich:column style="text-align: center;">
                <f:facet name="header">Assunto</f:facet>
            <h:outputText value="#{solicitacao.assunto}" />
            </rich:column>

            <rich:column style="text-align: center;">
                <f:facet name="header">Mensagem</f:facet>
            <h:outputText value="#{solicitacao.mensagem}" />
            </rich:column>

The problem is that the editor inserts the code of the message in html and after included it will show the inserted html.

Ex of the message field: <h1>Teste de inclusao na <span style="font-family:arial,helvetica,sans-serif">Mensagem Enviar Solicita&ccedil;&atilde;o</span> para a peg 4415</h1>

Include Test in Message Send Request to peg 4415

How can I display this content in the dataTable the same way I wrote it in the Editor, ie without the html tags?

    
asked by anonymous 06.11.2017 / 12:16

1 answer

0

The default of JSF is to escape the tags of HTML and XML , what you need to do is disable it.

For the tag outputText just set the escape attribute to false :

<h:outputText escape="false" value="#{solicitacao.mensagem}" />
    
06.11.2017 / 12:27