简体   繁体   中英

Escape false is not working in primefaces?

I am using primefaces 3.2 and I have used escape=false for the outputText to display the output. This is not working for me.

val = "<ol><li>sfsfsd</li><li>fgsdsdg</li></ol>"
<h:outputText escape="false" value="#{dummyBean.val}" />

It is not displaying the numbers instead I am getting a dot (.) on display.

I am gettting output like :

. sfsfsd
. fgsdsdg

But the expected output is :

 1.sfsfsd
 2.fgsdsdg

A weird idea: what if the html is indeed escaped but you have some styling issue which hides the numbers before the dots. I would try to add some left padding either to the printed list

<ol style="padding-left: 100px;">
    <li>First</li>
    <li>Second</li>
</ol>

or to the span itself

<h:outputText escape="false" value="#{dummyBean.val}" style="padding-left: 100px;"/>

and see what happens.

What you're looking for is just a different way to style an ordered list.

You just need to add this style

ol {
    list-style-type: decimal;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM