Fusebox 4.1 XML Cheat Sheet
Fusebox.xml
circuits
Defines folders of fuses and their relationships with each other.
<circuit alias="any_name" path="my_circuit" parent(optional)/>
classes
Defines objects that you will use in your application. Does not create any instances of them.
<class alias="Employee" classpath="com.company.Employee" type="component" constructor="init">
lexicons
Defines a 'custom tags' folder for your circuit files that are included at compile time.
<lexicon namespace="tagprefix" path="relative to the lexicon folder, include trailing slash/" />
To call a lexicon in the above-defined lexicon folder:
<tagprefix.yourFileName/>
parameters
name/value pairs for important fusebox parameters
globalfuseactions
Defines any fuses that are executed at the beginning and ending of every request to the fusebox app.
<preprocess><fuseaction action="circuit.fuse"></preprocess>
<postprocess/>
plugins
Allows you to include files at specified places in the processing of your fuse. Put your plugin files in the plugins folder.
<phase name="preProcess|preFuseaction|fuseactionException, etc."><plugin name="pluginName" template="file"/></phase>
Circuit.xml
set
Sets a variable.
<set name="variables.name" value="value" Overwrite(optional) Evaluate(optional)>
do
"Does" a fuse from another circuit (action="circuit.myFuse") or from the current circuit (action="myFuse").
<do action="circuit.fuse" contentvariable(optional) append(optional, for contentvariable) overwrite(optional i.e. cfparam)>
include
Includes a file. File should be from the current folder (circuit). Does not require the file extension.
<include template="myfile" required(optional) contentvariable(optional) append(optional, for contentvariable)>
Required="false" will not throw a missing file error.
relocate
Forwards the user to another request.
<relocate url="http//..." addtoken(optional) type="(optional)client|server">
type="server" is equivalent to getPageContext().forward('page.cfm') - a server-side redirect.
loop
Creates a simple loop.
<loop condition="i lt 3">
<loop query="myQuery">
if
Conditional processing. Somewhat limited in the way that there is no 'else if' and you cannot nest <if> tags.
<if condition="myVar GT 4">
<true>
<do action="something"/>
</true>
<false/>
</if>
xfa
Defines exit points, can be used in href= or form action=, etc. XFAs should always be in the format of "circuit.fuse"
<xfa name="myXfa" value="circuit.fuse">
instantiate
Creates an instance of an object referenced in fusebox.xml's classes section.
<instantiate object="application.blog" class="blog" arguments="#params#">
invoke
Invokes a method from an object that has been instantiated. Does not implicitly rely on the <instantiate> tag.
<invoke object="application.myObject" methodcall="myMethod(id,true,'hello')" returnvariable=(optional)"myVariable">
prefuseaction
Defines the section for events that fire before any fuses from this circuit are called. Beware of possible recursion issues.
postfuseaction
Defines the section for events that fire after any fuses from this circuit are called. Again, beware of possible recursion issues.
Fusebox 4.1 General Notes
variables.myFusebox
thisCircuit, thisFuseaction, originalCircuit, originalFuseaction
fusebox.init.cfm
Should consist of (at minimum):
request.self = "index.cfm";
request.myself = "#request.self#?#application.fusebox.fuseactionVariable#=";
So you can say <a href="#request.myself#circuit.fuse">
access
Circuit and fuseaction tags have access modifiers:
Public = Can be called from a browser
internal = Can only be called from fusebox (via <do>)
private = Can only be called from the current circuit