Raymond's approach was typical in the mid 2000's. He posted a form to a .cfm page, and the server processed server side logic as well as performing client side operations, like setting form values on the client. However, Ajax is a different beast. Most of our Kendo HTML5 interfaces do not post to another HTML page. Instead, the UI elements, such as the Kendo window, posts limited data to a function that has to perform all of the logic without refreshing the client page. However, for several reasons, the blog.cfc component does not have all of the information that I need to do this successfully.
First, we can't get session vars in the main blog.cfc. Raymond (and et-al) had another application.cfm in the org/cambden/blog folder that prevented this component from having access to the session variables set on the /blogCfc/application.cfm template. Cfc's should have access to the session scope unless it finds another application.cfm (or cfc) template, and here, this is the case.
I tried in vain to get the blog.cfc component to work for my purposes. After finding and eliminating the 'other' application.cfm template which caused problems accessing the session scope, I was able to obtain session variables, but the elimination of the application.cfm template in the same directory caused new problems. One example is that the isUserInRole function is now erroring out with an 'You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members.'. This new error was raised throughout the blog.cfc template.
Another issue is that I suspect that the /blogCfc/org/delmore/coldfishconfig.xml file is not working when the application.cfm template is disabled. This file most likely deals with the cfauthentication tag.
In order to have the session scope, and in order to potentially cache the code after an ajax operation, I had to develop a new template to act as a proxy. I am not using a .cfc component for ajax post operations as I need the session variables and need to perform client side operations, such as setting form values, and caching the output of the page.
Goals: The proxy template will use Raymond's blog.cfc to perform all database operations. Whenever possible, I will perform server side business logic using Raymonds Blog.cfc.
This entry was posted on November 9, 2018 at 10:42 PM and has received 237 views.