function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PronowPronow 

Rendering HTML code on visualfroce

Hello there,

 

I want to display a string variable of Page Controller on its corresponding Visualforce Page. I can do it using forllowing code:

 

<apex:outputText style="font-style:italic" value="{!strOperationStatus}"/>

 

However, {!strOperationStatus} is a string variable. That variable contains some HTML code. But, visualforce page displays that content with Tags like this:

 

<HTML><P>....some contents....</p></HTML>

 

I want to display contents only.

 

Please tell me a way t do this. I want to do this in this perticular way only as this string will be dynamic.

 

Thank you.

 

Best Answer chosen by Admin (Salesforce Developers) 
RockDeveloperRockDeveloper

Use escape = false in your output text.

<apex:outputText value="{!stropertionStatus}" escape="false" />

All Answers

RockDeveloperRockDeveloper

Use escape = false in your output text.

<apex:outputText value="{!stropertionStatus}" escape="false" />

This was selected as the best answer
AshlekhAshlekh

Hi,

 

Consider you have field on object field like text(rich area ). when ever you show or bind this field with page using <apex:outputText>

then you can use

<apex:outputText value="{!TEXT_AREA_RICH}" escape="false"/>

 

If this will help you than please dont forget to give mi kudo's.

 

Thanks

Ashlekh Gera

PronowPronow
Thank you very much.