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
pooja Agichapooja Agicha 

Decoding the encoded HTML and dispay in Visualforce page

Hi,

I have the Encoded HTML in my visual force page (eg: < &quote;) but how to convert it back into HTML and render the page in Visualforce?

 

 

Thanks,

 

Regards ,

Pooja

Venkat PolisettVenkat Polisett

pooja Agicha wrote:

Hi,

I have the Encoded HTML in my visual force page (eg: < &quote;) but how to convert it back into HTML and render the page in Visualforce?

 

 

Thanks,

 

Regards ,

Pooja


 

I believe you are putting mark up in a variable and trying to show that in a VF Page:

 

In your controller:

  

      String myMarkup = '<strong>This is bold</strong>';

 

In your VF Page:

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

 

escape="false" will display your markup with out escaping it. Use caution though. Please read docs regarding the warnings.

pooja Agichapooja Agicha

Hi,

 

Thanks for the reply.I used escape=false in outputtext tag,But it is rendering html text (eg: <p>text</p>).

I actually want to display the result of the HTML.

 

 

Thanks,

Regards,

Pooja

Venkat PolisettVenkat Polisett
Post your code snippet.
pooja Agichapooja Agicha

<apex:page sidebar="false" showheader="false" standardcontroller="opportunity" extensions="hotdocTemplateController" tabstyle="Task" renderas="html" contenttype="text/html" >

 

 

<apex:pageBlock id="pbtaskdesc">
    <apex:form id="hdformEntry" >
        <apex:pageBlockSection title="Hot Docs" columns="1">
            <apex:pageBlockSectionItem >
             <apex:inputHidden id="disValue" value="{!HotdocDisplay}" rendered="true"/>
                 <apex:Outputtext id="txtnotes" value="{!HotdocDisplay}" StyleClass="labelCol"></apex:Outputtext>                             
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >           
                <input class="btn" type="button" id="btnclose" value="Test" onclick="display();"/> 
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        </apex:form>
    </apex:pageBlock>
   
</apex:page>

 

 

Controller class(I am Passing parameters from Visual force page1 to visualforce page 2.This is my 2nd VF page and  controler)

 

public class hotdocTemplateController

{

public String HotdocDisplay{get;set;}

 public hotdocTemplateController(ApexPages.Standardcontroller stdcontroller)

{

HotdocDisplay= ApexPages.currentPage().getParameters().get('HDdisplay');

 

system.debug('Encoded String'+HotdocDisplay);

Blob b = Blob.valueOf(HotdocDisplay);

String b64 = EncodingUtil.base64Encode(b);

HotdocDisplay = EncodingUtil.urlDecode(b64, 'UTF-8');

b = EncodingUtil.base64Decode(HotdocDisplay);

HotdocDisplay = b.toString();

 

}

}

pooja Agichapooja Agicha

Sorry earlier pasted the wrong Outputtext tag.controller is correct. 

 

<apex:pageBlock id="pbtaskdesc">

<apex:form id="hdformEntry" >

<apex:pageBlockSection title="Hot Docs" columns="1">

<apex:pageBlockSectionItem >

 <apex:inputHidden id="disValue" value="{!HotdocDisplay}" rendered="true"/>

<apex:Outputtext id="txtnotes" value="{!HotdocDisplay}" StyleClass="labelCol" escape="False"></apex:Outputtext>

</apex:pageBlockSectionItem>

 <apex:pageBlockSectionItem >

<input class="btn" type="button" id="btnclose" value="Test" onclick="display();"/>

</apex:pageBlockSectionItem>

</apex:pageBlockSection>

</apex:form>

</apex:pageBlock>

 

</apex:page>