Skip to content

Getting started with Railo Server

jameskilford edited this page Apr 10, 2013 · 33 revisions

So, you're ready to get started with Railo Server? Great! You'll be up and running in just a couple of minutes.

The best way to get started is to use Railo Express - you can run it on Windows, OS X or Linux, and you don't need to install it. Just unzip (or tar) it and you're good to go.

Download & run

  1. The first step is to head over to the downloads page and choose one of the Railo Express versions.
  2. Follow the installation instructions (Installation:ExpressJetty)

The Railo Express installation instructions will guide you through unpacking, starting and testing Railo Express.

Your first Railo Server template

Most people will end up going to http://localhost:8888 after they've installed Railo Express, and if it's all gone well, you'll see the "Welcome to the Railo World!" page. If not, now's a good time to find out how to get help.

The "Welcome to the Railo World!" page is very helpful, because it tells us a lot of information about the Railo Server - the Railo version, the Java version, and lots more besides - including the path where CFML files are served from. You'll find the website's folder under "Important Notes".

If you've read the page about getting to know Railo Server, you'll know that Railo Server uses CFML files, and we'll create our first CFML file (or template) now.

In your file explorer, find the website folder, create a file called myFirstPage.cfm and add the following to it:

<!DOCTYPE html>
<html>
	<head>
		<title>My first page</title>
	</head>
	<body>
		<h1>Hello World!</h1>
		<cfoutput>
		<p>The time is #now()#</p>
		</cfoutput>
	</body>
</html>

Save the file, then head to http://localhost:8888/myFirstPage.cfm

You should see something like the following:

Hello World!

The time is {ts '2013-04-10 01:30:37'}.

If you did, congratulations! You've written your first CFML template. What's going on though? Well, if you know HTML, the template will be mostly familiar. Railo Express has output the HTML as you wrote it. Unless you tell it otherwise, Railo Express will always output whatever's written in your template.

The things you won't recognise are <cfoutput> and #now()# because these are instructions to Railo Express. When it encounters these, it interprets them and replaces them in the page with some output.

<cfoutput> is a command that tells Railo Express that it should look out for functions. Like HTML, it has a corresponding closing </cfoutput>.

#now()# is a CFML function call. When Railo Express is inside a <cfoutput> block and sees a # sign, it knows it should expect a function call - it will run the function and put the results right into the page. As you've no doubt guessed, #now()# returns the current date and time.

Clone this wiki locally