cfscript - invoke component
artscomponent.cfc
<cfcomponent displayname="ArtsCFC" hint="Art Discover">
<cffunction name="GetArts" access="remote" returntype="query">
<cfargument name="ArtistID" type="numeric" required="yes">
<cfargument name="MaximumPrice" type="numeric" required="yes">
<cfquery name="ArtDetails" datasource="cfcodeexplorer">
Select ArtName, Description, Price
From ART Where ArtistID = #arguments.ArtistID# And Price <= #arguments.MaximumPrice#
</cfquery>
<cfreturn ArtDetails>
</cffunction>
</cfcomponent>
invokecomponentcfscript.cfm
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>How to invoke component in cfscript tag</title>
</head>
<body>
<h2 style="color:DarkBlue; font-style:italic">
How to invoke component in cfscript tag
</h2>
<hr width="400" align="left" color="PowderBlue" />
<br />
<cfscript>
artsObject = CreateObject("component","artscomponent");
artistID = 1;
maximumPrice = 13000;
arts = artsObject.GetArts(artistID,maximumPrice);
</cfscript>
<cfdump var="#arts#">
</body>
</html>
- CFMAP - Generate an earth type google map in ColdFusion
- CFMAP - How to change google map marker color in ColdFusion
- Generate a google map with specific latitude and longitude in ColdFusion
- CFAJAXIMPORT to specify Google map API Key in ColdFusion
- cfqueryparam- how to use cfqueryparam in cfquery tag
- How to use cfsqltype in cfqueryparam tag in ColdFusion
- ColdFusion - How to use IS NOT operator in cfif conditional processing
- How to use variable prefixes in ColdFusion
- How to create a border type layout in ColdFusion
- How to determine whether a file exists in ColdFusion