
1308
DEVELOPING
COLDFUSION 9 APPLICATIONS
Using External Resources
Las
t
upda
te
d 8/5/2010
<cfscript>
returnVal = structNew();
returnVal.command = "submit";
returnVal.sourceAddress = arguments.CFEVENT.gatewayid;
returnVal.destAddress = arguments.CFEVENT.originatorid;
//No records were found.
if (employees.recordCount eq 0) {
returnVal.shortMessage = "No records found for '#message#'";
}
//One record was found.
else if (employees.recordCount eq 1) {
// Whitespace in the message text results in bad formatting,
// so the source cannot be indented.
returnVal.shortMessage = "Requested information:
#employees.firstName# #employees.lastName#
#employees.Department#
#employees.Phone#";
}
//Multiple possibilities were found.
else if (employees.recordCount gt 1) {
//If more than ten were found, return only the first ten.
if (employees.recordCount gt 10)
{
returnVal.shortMessage = "First 10 of #employees.recordCount# records";
}else{
returnVal.shortMessage = "Records found: #employees.recordCount#";
}
// The session.users structure contains the found names.
// The record key is a number that is also returned in front of the
// name in the message.
session.users = structNew();
for(i=1; i lte min(10, employees.recordCount); i=i+1)
{
// These two lines are formatted to prevent extra white space.
returnVal.shortMessage = returnVal.shortMessage & "
#i# - #employees.firstName[i]# #employees.lastName[i]#";
// The following two lines must be a single line in the source
session.users[i]="#employees.firstName[i]# #employees.lastName[i]#";
}
}
return returnVal;
</cfscript>
</cffunction>
</cfcomponent>
Using the FMS event gateway
The FMS event gateway provides interfaces between the Flash Media Server 2 and the Adobe ColdFusion server. As a
result, ColdFusion applications and Adobe Flash clients can share data.
Before you use the gateway, become familiar with ColdFusion event gateway principles and programming techniques
(see “
Using Event Gateways
” on page 1254). A basic knowledge of Flash Media Server is also helpful.
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...