Tags in CFScript

For a while now, Railo has had the ability to use most of the built-in tags within the <cfscript> tag. All you have to do is remove the <cf at the start and usually, if it is a single line replace the > at the end with ;. For example:

<!---
instead of
<cfparam name="url.age" type="numeric" default="10" max="100" min="18">
You can do
--->
<cfscript>
param name="url.age" type="numeric" default="10" max="100" min="18";
//How about cfhttp ?
http method="GET" url="http://www.google.com" result="webPage";
</cfscript>

Tags with opening and closing brackets Of course, there are a number of other tags that we could use that are not just single line. How about tags that wrap some kind of content? Tags like <cfmail>, <cfloop> and <cfquery>? They are just as easily used with {} brackets!

<cfscript>
//Send an email
mail from="Mark@getrailo.com" to="gert@getrailo.com" subject="Awesome! Tags in Script!"{
WriteOutput("Hey Gert!
Check out the code samples here! You can write tags in CFScript
Mark
");
}
//Query a database
query name="getUsers" dataSource="myDatasource"{
echo("SELECT * FROM tusers WHERE UserID =");
queryparam cfsqltype="varchar" value="6300EE15-1320-5CC2-F9F48B9DBBA54D9F";
}
dump(getUsers);
</cfscript>

As you can see in the examples above, if you have text you can output it using the WriteOutput() or echo() functions. And of course, you can use other tags in script within these tags!