Skip to content

Instantly share code, notes, and snippets.

@nastanford
Last active January 4, 2016 13:09
Show Gist options
  • Save nastanford/8625878 to your computer and use it in GitHub Desktop.
Save nastanford/8625878 to your computer and use it in GitHub Desktop.
Beginner ColdFusion – ColdBox Art Gallery – Lesson 2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion Art Gallery</title>
</head>
<body>
<!--- Render The View. This is set wherever you want to render the view in your Layout. --->
<cfoutput>#renderView()#</cfoutput>
</body>
</html>
/**
* Home
*/
component{
// OPTIONAL HANDLER PROPERTIES
this.prehandler_only = "";
this.prehandler_except = "";
this.posthandler_only = "";
this.posthandler_except = "";
this.aroundHandler_only = "";
this.aroundHandler_except = "";
// REST Allowed HTTP Methods Ex: this.allowedMethods = {delete='POST,DELETE',index='GET'}
this.allowedMethods = {};
function preHandler(event,action,eventArguments){
var rc = event.getCollection();
}
function postHandler(event,action,eventArguments){
var rc = event.getCollection();
}
/**
function aroundHandler(event,targetAction,eventArguments){
var rc = event.getCollection();
// executed targeted action
arguments.targetAction(event);
}
*/
function onMissingAction(event,missingAction,eventArguments){
var rc = event.getCollection();
}
function onError(event,faultAction,exception,eventArguments){
var rc = event.getCollection();
}
function index(event){
event.setView("home/index");
}
}
This is the Home View and the Index Action of the ColdFusion Art Gallery.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment