DevLearningTools

🚧 This site is under active construction — new tools, guides, and pages are added every week.

MODULE 1 · LESSON 04

Hello, World! Your First ColdFusion Program

Creating and running your first real .cfm file — both CFScript and tag syntax, the full request lifecycle, why the browser only ever sees HTML, and a hands-on exercise.

This is a fast-start preview lesson. The full version — with diagrams, a live code playground, a quiz, and interview questions — is on the way as Module 1 gets built out in full.

Every programming language begins with a simple "Hello, World!" program. The goal isn't to build something useful — it's to verify that your entire development environment is working correctly.

By the end of this lesson, you'll:

  • Create your first ColdFusion page.
  • Understand what a .cfm file is.
  • Run your application in a web browser.
  • Learn how ColdFusion processes a request.
  • Write "Hello, World!" using both CFScript and tag syntax.

What Is a .cfm File?

A .cfm (ColdFusion Markup) file is a ColdFusion template — a plain text file that can contain HTML, CFML, CSS, and JavaScript.

When a browser requests a .cfm file, the ColdFusion engine processes any CFML code inside it, generates the final HTML, and sends that HTML to the browser. The browser never receives your original .cfm file or your CFML code — only the generated HTML.

Where Is wwwroot?

The wwwroot folder is your website's web root — the directory ColdFusion serves web pages from. It's usually located here:

Operating SystemPath
WindowsC:\ColdFusion2025\cfusion\wwwroot
Linux / macOS/opt/ColdFusion2025/cfusion/wwwroot

Every .cfm file you create during this course should be placed inside this folder (or one of its subfolders):

wwwroot/
wwwroot/
│
├── hello.cfm
├── index.cfm
└── images/

Create hello.cfm

Inside the wwwroot folder, create a new file named hello.cfm. We'll use this file to display our first message.

ColdFusion supports two ways of writing code — CFScript (modern and recommended) and tag syntax (traditional CFML). Both produce exactly the same output.

Hello World Using CFScript

hello.cfm — CFScript
Simulated output — illustrative only, not a live ColdFusion/Lucee server.

How It Works

  • <cfscript> starts a CFScript block.
  • writeOutput() is a built-in ColdFusion function that sends text to the browser.
  • "Hello, ColdFusion!" is a string.
  • ; marks the end of the statement.
  • </cfscript> ends the CFScript block.

Hello World Using Tag Syntax

The same program can also be written using traditional CFML tags.

hello.cfm — tags
Simulated output — illustrative only, not a live ColdFusion/Lucee server.

CFScript vs. Tag Syntax

Both examples produce the same result.

Recommendation: throughout this course, we'll primarily use CFScript, as it is the preferred style for modern ColdFusion development. However, you'll also learn tag syntax because many existing applications and templates use it.

CFScriptTag Syntax
Looks similar to Java, JavaScript, and C#Looks similar to HTML
Preferred for most new application logicCommonly used in templates and for some built-in features
Easier to organize in large applicationsEasy to read for simple markup

Run the Application

Save the hello.cfm file, then open your browser and visit:

EngineURL
Adobe ColdFusionhttp://localhost:8500/hello.cfm
Lucee (default installation)http://localhost:8888/hello.cfm

If everything is configured correctly, you'll see "Hello, ColdFusion!" — congratulations, you've just created and executed your first ColdFusion application.

Understanding the Request Lifecycle

When you open hello.cfm, several things happen behind the scenes.

Browser
Web Server (Tomcat / IIS / Apache)
ColdFusion Engine
Executes CFML Code
Generates HTML
Browser

Step-by-Step

  • Your browser requests hello.cfm.
  • The web server forwards the request to ColdFusion.
  • ColdFusion reads the .cfm file.
  • The writeOutput() function executes.
  • ColdFusion generates plain HTML.
  • The browser displays the result.

Why the Browser Only Sees HTML

One of the most important concepts in server-side programming is that your ColdFusion code never leaves the server — the browser only receives the HTML generated by ColdFusion. If you right-click the page and select View Page Source, you'll see something like:

page source — what you'll see
Hello, ColdFusion!
page source — what you will NOT see
<cfscript>
    writeOutput("Hello, ColdFusion!");
</cfscript>

This is one of the reasons server-side technologies are secure. Sensitive information — such as database credentials, passwords, and business logic — stays on the server and is never exposed to the user's browser.

Common Beginner Mistakes

Saving the file in the wrong folder

Your .cfm file must be inside the wwwroot directory (or one of its subfolders). Otherwise, the web server won't be able to find it.

Using the wrong URL

Make sure you're using the correct port number, file name, and .cfm extension. Even a small typo results in a 404 Not Found error.

ColdFusion service is not running

If the page doesn't load, verify that the ColdFusion (or Lucee) service is running, and restart it if necessary.

Best Practices

  • Use CFScript for new projects.
  • Keep your learning examples small and focused.
  • Save all practice files inside the wwwroot folder.
  • Use meaningful file names, such as hello.cfm, variables.cfm, or loops.cfm.

Try It Yourself

Modify the program to display your own name:

hello.cfm
Simulated output — illustrative only, not a live ColdFusion/Lucee server.
NOTE

Save the file, refresh your browser, and verify that the output changes.

Summary

In this lesson, you learned how to:

  • Create your first .cfm file.
  • Understand the purpose of the wwwroot folder.
  • Write your first ColdFusion program using CFScript.
  • Write the same program using tag syntax.
  • Run a ColdFusion page in the browser.
  • Understand how ColdFusion processes requests before sending HTML to the browser.

What's Next?

In the next lesson, we'll explore the ColdFusion Administrator — the web-based dashboard you'll use to configure datasources, manage server settings, schedule tasks, and administer your ColdFusion server.