Fusioncube

The online journey of a technophile, by Steve Brownlee

Archive for May, 2008

Invoking ColdSpring beans with ajaxCFC

Tuesday
May 20,2008

As a heavy user of Rob Gonda’s ajaxCFC library, I’ve incorporated it into almost every app I’ve written in the past two years. The only restriction that required me to write workarounds was the fact that you could only invoke ColdFusion Components directly. The thing is, I also love ColdSpring to manage dependencies and to implement my Aspect Oriented Programming components.

What I want is to be able to call my ColdSpring beans with ajaxCFC so that I can make my asynchronous calls, get serialized data back, and all the while utilizing the dependencies set up in my beans. Well, I finally got around to modifying Rob’s code to allow for this. I use the jQuery branch, so my solution currently only works for that implementation. I may try to work on the DWR version, but that’s unlikely because I don’t use it.

There are three changes to how you invoke ajaxCFC in order to work with ColdSpring beans.

The URL Attribute

Instead of the URL value being the path to your logic component, its value should be the path to the ajax.cfc component

url:'com/company/common/ajax/ajax.cfc'

The Bean Attribute

This property’s value will be the name of the ColdSpring bean you want to use.

bean: 'Facility'

The Factory Attribute

This property’s value will be the name of your ColdSpring bean factory.

factory:'application.beanFactory'

A Complete Invocation

Here’s a sample call stripped directly from one of my applications

$.AjaxCFC({
	url:'com/company/common/ajax/ajax.cfc',
	bean: 'Facility',
	factory:'application.beanFactory',
	method: 'getFacilities',
	data: { 'orderby':orderByField },
	useDefaultErrorHandler: false,
	success: function(results) {
		$('#facilitySelectContainer').html(results);
	},
	error: function(results) {
		Ext.MessageBox.alert('Error Notification', 'There was an error while loading the facilities. Please try again.')
	}
});

The Code

There are two files you need to replace.

  1. ajax.cfc
  2. jquery.AjaxCFC.js

Download ColdSpring-enabled ajaxCFC

Wednesday
May 7,2008

I was trying to call an Oracle function from ColdFusion today and was just receiving error, after error, after error… well you get the point. Long story short, I couldn’t successfully get a response since there is no binding between ColdFusion and the Oracle BOOLEAN type, and the function was returning BOOLEAN. So I changes the response to 0/1 and it works.

Just something to keep in mind.

<cfquery name="myQueryName" datasource="myDS">
    select myPackage.myFunction(myArg1, myArg2) response from dual
</cfquery>
<cfdump var="#myQueryName.response#">

Tech toy worth the money

  • Filed under: IT
Wednesday
May 7,2008

I recently moved the family to some new digs south of Nashville, and the house is nice, has plenty of space, but we are unfortunately still renting while I replenish my cash reserves. I had setup my home office in the upstairs 4th bedroom, but the Tivo and Xbox were downstairs in the living room.

I’m also a wired kinda guy. I know the Xbox and Tivo will both work wirelessly, but if I can plug directly into the network, I always feel better. The problem is, since I’m renting, my ability to effectively get a wire from upstairs to downstairs is significantly hampered. No drilling, no modifying the existing wiring the house, etc.

To my delight, as I was wandering around Best Buy last week (had to replace my monitor cable since the dog had chewed through it), I stumbled across a box from Netgear – Powerline Ethernet Adapters. I wish I had known about these back when I lived in Pittsburgh. I had wires running all over the house and in the walls. These would have saved me a lot of weekend hours and sweat.

About Steve

I am a technologist, and have been ever since 1980 when I got my very first TRS-80 and programmed it to do my math homework. I love to share the gift of technology with others and show them the wonderful things it can do for them, and how they should not fear it, but embrace it.

Latest Tweets

  • Ok... stayed up way too late trying out website designs for my wife's new nonprofit. The kids will be getting me u... — http://t.co/QrKh5iBI
  • Am I the only one who likes Google’s new privacy policy? http://t.co/qwcym5wH
  • All that time wasted learning the .NET framework - Fusioncube - http://t.co/krANoWmg
  • @marcesher libraries like Less only do what you tell them. You can make a mixin to do that, but it doesn't assume anything (which is good)
  • Circus about to start. Girls are so excited they can't stand it!!!! (with Sabrina and Tessa at @BrdgstoneArena) [pic] — http://t.co/PXwi5emj

Subscribe

Entries (RSS)
Comments (RSS)