For Adobe ColdFusion application servers Writing your Server Page

When your server URL receives a request, it generates a simple HTML page in response. This page generates a JavaScript variable, and that variable is passed back to the client.

Create a folder and copy the Application.cfm and OnRequestEnd.cfm files from the serverpages folder in the download package. These files take care of generating the page, writing the JavaScript and passing the data back to the client. Your code will be sandwiched between these two files. You need to process the parameters (in the scope), compute a response, and save your response in the ColdFusion variable request.response. Your response could be a string, a number, a structure, an array, a query record set, or any other data structure.

If you like, you may use a ColdFusion component (CFC) as the server page. This is a good idea if you want to provide a range of different types of responses. Each method in the can handle one type of response. To use a , you must pass a method parameter to your gateway. The method specifies the method in the that will be invoked. Within your method, be sure to set access="remote", and don't return data in the usual way with a cfreturn tag. Instead, set a value for request.response. Parameters passed to the server will be available within each method as arguments.

You could also use a Fusebox-style switch statement to choose between a variety of different types of response. Most of the examples demonstrate this approach.

Uniform Resource Locator
ColdFusion Component
HyperText Markup Language
The coding language used to create hypertext documents for use on the World Wide Web.