简体   繁体   中英

Primefaces outputlabel behaves as escape = “false”

I am using primefaces 4.0 and I am having problems with p:outputLabel. When It is mixed with any other primefaces component it behaves like escape="false"

This field is not processed even if I specify escape="true"

Example: I have the following html code:

<h:form>
    <p:outputLabel value="&lt;b&gt;TEXT&lt;/b&gt;" escape="true"></p:outputLabel>
    <h:outputLabel value="&lt;b&gt;TEXT&lt;/b&gt; " escape="true"></h:outputLabel>
</h:form>

And for the Output I have this

<b>TEXT</b> <b>TEXT</b>

Which is expected behavior. (I am willing to see HTML tags as text).

But when I will add any other primefaces tag like in example:

<h:form>
    <p:outputLabel value="&lt;b&gt;TEXT&lt;/b&gt;" escape="true"></p:outputLabel>
    <h:outputLabel value="&lt;b&gt;TEXT&lt;/b&gt; " escape="true"></h:outputLabel>
    <p:commandButton value="button"></p:commandButton>
</h:form>

Now even I have escape="true" I get

TEXT TEXT and then the button.

Does any one have experience with this how should I fix this. Any suggestion.

I solved this issue.

I had this into my pom

<dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.1.12</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.1.12</version>
    </dependency>

I just downgraded to 2.1.11 and everything works fine.

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