0

I know it's a simple question, but I've got stuck here. How to display html formatting on liferay? I have tried to use outputText or outputLabel, but on the page view, it still display as is. For example (supposed backing.val value is output <b>text</b>):

<h:outputText value="#{backing.val}" />
  --> output <b>text</b>

<p:outputLabel value="#{backing.val}" />
  --> output <b>text</b>

I want the text is bold. How to do that? Thank you very much.

2 Answers 2

2

Adding escape="false" is vulnerable for Cross Site Scripting.

Why don't you use style or styleClass instead?

In this case, your output from the bean should be just text and not <b>text</b>

<h:outputText value="#{backing.val}" style="font-weight:bold;"/>

OR

<h:outputText value="#{backing.val}" styleClass="boldTextClass"/>

.boldTextClass
{
  font-weight: bold;
}
Sign up to request clarification or add additional context in comments.

Comments

2

Add escape="false" attribute:

<h:outputText value="#{backing.val}" escape="false"/>

More information can be found here: http://www.jsftoolbox.com/documentation/help/12-TagReference/html/h_outputText.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.