Question: I am trying to display the contents of a remote text file on a Visualforce Page.
I have implemented a class called MyApexClass containing a getTextFileContentAsString method that returns the content of a remote text file as a string.

I then try to invoke that method in the Visualforce page and display it with apex:outputText like so "{!MyApexClass.TextFileContentAsString}". However, I get an error saying:

```
Error: Unknown property MyApexClass.TextFileContentAsString referenced in MyTemplate. 

```

What is the correct way to invoke the method, and get the returned string to render on the VisualForce page?

Here are the Apex Class and the VisualForce page excerpts:

**Apex Class:**

```
public class MyApexClass {

  public String getTextFileContentAsString() {
    String url = 'http://somehost.com/theTextFile.txt';
    Http h = new Http();
    HttpRequest req = new HttpRequest();
    req.setEndpoint(url);
    req.setMethod('GET');
    HttpResponse res = h.send(req);
    return res.getBody();
  }
}

```

**VisualForce Page excerpt:**

```
...
<div>
<apex:outputText value="{0}">
<apex:param value="{!MyApexClass.TextFileContentAsString}" />
</apex:outputText>
</div>
...

```

Do I need to do anything special to make the MyApexClass "visible" to the VisualForce page?

Answer: 
Your approach is just fine. It's just lacking an exclamation mark, and the argument should be removed, try:

```
<apex:param value="{!TextFileContentAsString}" />

```

Then hard-code the URL into the req.setEndpoint in your Apex class. (Visualforce getters cannot have parameters)
This {!}, is the syntax for merge fields in visualforce. I guess you are missing '!'. You can also cast responce body to string, just to be sure.