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
mahesh1.396434879374128E12mahesh1.396434879374128E12 

Display the text data which is present in the static resource, on a Visual Force page

I am having a static resource which consists of a text file. I want to show the text on the Visual Force page.
kiranmutturukiranmutturu
get the staticresource body in to a controller by querying the staticresource object with body field . Body filed is base64 so you need to convert this to string and then bind this to vf merge field as a property
mahesh1.396434879374128E12mahesh1.396434879374128E12
Thanks Kiran.......


I got the Output for the text data (data.txt).....Now i want to use the HTML File( file.html).

But it is showing in the encrypted format....can you help me in this issue..... 

This is the code i used for getting the Text data on the VF page.......

VF Page:
<apex:page controller="MyStatic">
<apex:outputText value="{!textFromSomeUniqueName}">
</apex:outputText>
</apex:page>

controller:
public with sharing class MyStatic {
public String textFromSomeUniqueName {
    get {
            StaticResource sr = [select Body from StaticResource where Name = 'StaticText' ];
        return sr.Body.toString();
    }
}
}

Suggest me to get the HTML FILE data on the VF Page....