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.
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'
This property’s value will be the name of the ColdSpring bean you want to use.
bean: 'Facility'
This property’s value will be the name of your ColdSpring bean factory.
factory:'application.beanFactory'
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.')
}
});
There are two files you need to replace.
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#">
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.