While writeOutput writes to the page-output stream, this function writes to the main response buffer

echo(string) → returns boolean

This function requires Lucee.  Not supported on Adobe ColdFusion, etc.

Argument Reference

string string

String to be written to the output buffer

Sample code invoking the echo function

Prints a simple string.

echo("hello world");

Expected Result: hello world

Note that complex objects will not automatically be converted to String, as with System.out.println in Java.

// Create data
data = {
    "title"  : "A Game of Thrones",
    "author" : "George R. R. Martin",
    "ISBN"   : "0-00-224584-1"

// Print data

Expected Result: {ISBN={0-00-224584-1}, author={George R. R. Martin}, title={A Game of Thrones}}

Fork me on GitHub