Creating ColdFusion Application using Fusebox 4.1
Published: 20 Dec 2007
This article contains the definition and elements of Fusebox. It describes how to create a ColdFusion application using Fusebox technology with an example.
by Babita Baliarsingha
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 27265/ 62


Fusebox is the powerful and standard framework to create the dynamic web sites or web based applications such as ColdFusion or PHP. There are several versions of Fusebox application. Fusebox4.1 is one of them.


A Fusebox 4.1 application consists of Circuits. A circuit corresponds to the directory of the application. There are one or more fuseactions in each circuit. A fuseaction is a request handeller. Fuseaction executes one or more fuses. Fuses are individual CFML pages in ColdFusion.

Fusebox requests are made of the server through a central controller called index.cfm. This is the central channel through which all requests pass and that contains several fuseaction methods.

Listing 1


Here, central controller is index.cfm and it receives the fuseaction message of document.login.

Document is the circuit name and login is the fuseaction name.


Fusebox 4.1 newly introduced the XML file rather than the previous version. This version uses XML for two purposes:

·         To provide configuration and initialization information application (i.e fusebox.xml file)

·         To provide configuration and initialization information for individual circuits (i.e circuit.xml file)

The Fusebox application has only one fusebox.xml file. It is located in the root directory of that application.

Let us first explain fusebox.xml.

The Fusebox XML file consists of root element, Fusebox and five prime sub elements.

·         Circuits

·         Classes

·         Parameters

·         Globalfuseactions

·         Plugins


The circuits' elements define each circuit in the Fusebox application. The circuits' elements contain one or more circuit elements. Each circuit has an attribute such as alias, path, and parent. The Syntax is:

Listing 2

<circuit alias=”document1” path=”member1” parent=””\>
<circuit alias=”document2” path=”member2” parent=””\>
<circuit alias=”document3” path=”member3” parent=””\>

·         The attribute alias is the name by which the circuit is called.

·         The attribute path defines the path to the directory which contains the circuit's own XML definition files.

·         The attribute parent is the name of the parent circuit, if required.


The classes element allows map aliases to the component objects. These component objects are ColdFusion component (CFC) files. The classes element consists of one or more class elements.

Here is an example using class elements.

Listing 3

<class alias=”Google” class path=”” type=”webservice” />
<class alias=”Address” class path=”” type=”component” 
    constructor=”init” /> 

·         The attribute alias is the name and specifies the class that will access in circuit.xml.

·         The attribute type defines the type of object for the class. The valid objects are:

a) component (if the class is CFC's)

b) java (for Java classes)

c) webservice (for Web services)

d) com (for COM object)

e) corba (for CORBA objects)

·         The attribute class path defines the path to the class. When we use the CFC, the class path is fulldot separated path to the CFC either from the webroot or a custom tag path. When we use java class, the class path is the java class path. For web service, the class path is the url to call the WSDL file for the web service.

·         The attribute constructor specifies the method within the object that defines its constructor. This attribute is optional.


The parameter elements are used to set the fusebox application parameter. Each parameter has attributes name and value.

Listing 4

<parameter name="fuseactionVariable" value="fuseaction" />
<parameter name="defaultFuseaction" value="document.login" />

The attribute fuseaction variable is used to set the value that your application will use. So the URL's and Forms can pass the fuseaction.

Listing 5



The Globalfuseaction has two sub elements.

a) Preprocess

b) Postprocess

In Preprocess, the fuseactions are executed at the beginning of every request. But in post process, the fuseactions are executed at the end of the every request.

Listing 6



The last element in fusebox.xml is plugins. The plugin element can contain several phase elements which define six possible places where the Fusebox core can be extended.

Listing 7

<phase name=”preProcess”></phase>
<phase name=”preFuseaction”></phase>
<phase name=”postFuseaction”></phase>
<phase name=”postProcess ”></phase>
<phase name=”fuseactionException”></phase>
<phase name=”processError”></phase> 

An individual plugin can be declared inside any phase.

Listing 8

<plugin name="pluginName" template="pluginFile">

This declaration tells Fusebox to execute the plugin file during the lifecycle of Fusebox.

So the structure of Fusebox.xml is:

Listing 9


Circuit.xml file

As there is only one fusebox.xml file in Fusebox application. We need the circuital file in each circuit's directory. This is defined as:

Listing 10

<circuit access=”public”>
<do action=”document.hello”>
<fuseaction name=”helloworld”>
<include template=”dsp_helloworld.cfm” />


The root element of circuit.xml is circuit. Within the circuit there are three sub elements.

a) prefuseaction

b) fuseaction

c) postfuseaction

The circuit has two optional attributes: access and permission. They are used to set default values for the same attributes on the fuseactions within the circuit.

The attribute access may be public, internal and private. If no access attribute is specified, the default value is internal. There is no default value for permissions.

The prefuseaction holds the fuseactions to be executed automatically before the initially called fuseaction is executed. If you have a request of index.cfm?fuseaction=document.helloworld and you have a fuseaction of within your prefuseaction element, document.home will be executed, followed by document.helloworld. The postfuseaction element automatically executes after the called fuseaction is completed.


How to display the Helloworld using fusebox technology?

Step 1

First off, download the core files from the website of Fusebox. I am going to be working in the folder D:\project\TestDocument accessible via my browser as http://localhost/FB4.

Since this is a web application, we need the web server. I have used the web server named Internet Information services (ISS). In the IIS, create the virtual directory FB4 whose local Path is D:\Project\ TestDocument in the properties.

Step 2

Create a cfm file called as dsp_helloworld.cfm in that folder containing the following code.

Listing 11

Hello World
<h3>Hello World!!</h3>

Now we have the display file that will display the message, but we need to do a little more to get the application to work.

Step 3

Create another file called circuit.xml.cfm. This file uses the XML to define the fuseaction within a particular circuit in the application.

Listing 12

<circuit access="public">
<fuseaction name="helloworld">
<include template="dsp_helloworld.cfm" />

Step 4

In this step we need to edit the fusebox.xml file to asign an alias to the circuit. The top the fusebox.xml contains the code.

Listing 13

<circuit alias="main" path="" parent="" />

Since we are creating simple application we do not need to worry about the path and parent attributes and change the alias name to document.

Listing 14

<circuit alias="document" path="" parent="" />

Finally, we need to set the value of defaultFuseaction of fusebox.xml to document.helloworld.

Open the browser and run the application via http://localhost/FB4 or http://localhost/FB4/index.cfm?fuseaction=document.helloworld. If all goes well, you should see "Hello World!!"

Figure 1


Finally, I would like to conclude that Fusebox framework is used in ColdFusion or PHP for developing the secure web application because no one can guess which page this is, due to fuseaction.

By Babita Baliarsingh

User Comments

Title: Hi Babitha   
Name: Sunitha Ketepally
Date: 2012-02-01 7:55:45 AM
Its really very nice article. I am new to Fusebox framework
Title: hello   
Name: madhu
Date: 2009-05-20 7:59:50 AM
It's quite interesting
Title: Nice Article   
Name: Chandrakanta Kar
Date: 2008-07-31 3:07:40 AM
This is nice article, for the peoples those working with ColdFusion Application and want to implement FuseBox or Upgrade the previous one for the application.

Good Work.
Title: its a good article   
Name: Abhishek Kumar Singh
Date: 2007-12-20 4:33:45 AM
Hi Babita,
nice article containing implementation methods for one of the latest requirement in web world. Surely page impersonation will be more secure.
Good article!!!

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2021  |  Page Processed at 2021-04-13 11:43:18 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search