WebDevelopment, ColdFusion, Railo, JS, Database and Tech-related by the Co-Founder and CEO of tunesBag.com

Wednesday, 29 April 2009

Railo - Compatibility issues with scopes (URL etc)

I'm migrating my development environment to railo and found some issues that affected my code.

One of the most important ones is that railo always references the scope name when you use URL, FORM etc no matter if a local variable with this name exists or not. To give you an example, run this code in CF and in railo:

<cfparam name="url.step" type="string" default="1" />

<cfset a_call = PrintURL( 'http://tunesBag.com/' ) />

<cfdump var="#a_call#">

function PrintURL( url ) {
return url;
To make railo behave the same way, you've to add a full reference to the function -
return arguments.url

In ColdFusion you'll see http://tunesBag.com as output, in railo the URL structure. Some further explanations concerning the scopes and this "bug" can be found here (Adobe Livedocs) and here (Railo Bugtracker)

Having fun with railo: CFQUERY supporting complex objects

I just came across a cool feature of railo - it's possible to set query columns to complex objects, e.g. a java object or a structure.

An example:

cfset q = QueryNew('data');
querySetCell( q, 'data', { firstname = 'John', surname = 'Doe' }, 1);

cfdump var="#q#"

You can access the structure by using q['data'][1]!


Important: This complex data won't survive a query of queries operation, in this case the simple classname will be shown in the column.