There was a typo in the PDF. Thanks to Simeon for pointing it out. Link is the right Tools box. For those who may have missed yesterday's post - this PDF is a simple skeleton of a proper Application.cfc file. I created because I tend to forget what each method returns and what arguments they take.
Archived Comments
Well to give accurate credit I must say that my eagle-eye friend Sean Corfield spotted the spelling mistake while we discussed why I couldn't get my session managment to work.
But thanks to Ray for the skeleton, and thanks to Sean for proving I was not crazy.
Let me ask again just to make sure. In the OnApplicationEnd you have the argument "applicationScope". In the OnSessionEnd you have the argument "appScope". Shouldn't the naming of the scopes be consistant? (just for general coding practices... noticed it because I am used to people pointing this type of thing out for me.)
John: The name of the argument is totally up to you. However, you are right, the naming should be consistent. I'll do another update tomorrow morninig.
Weird..the onRequest method in the application.cfc will not show the page in the browser. No error/debug message, just a blank page. If I take this method out, the page shows fine. Not sure what the problem is.
Are you using the exact same code from the PDF?
Yes I am, the exact same code. I even commented out several of the methods I not using yet. I only have
onApplicationStart, onApplicationEnd, and onRequest enabled (no commented out) and I get a blank page. When I comment out the onRequest method the page opens (has errors but opens). I want to include some udfs in this methods otherwise I would just leave it out. Thanks!
Sorry meant to say: I only have onApplicationStart, onApplicationEnd, and onRequest enabled (the other methods are commented out)..
Did you get the _latest_ copy? I had a typo that caused an error to fire. Since onError is blank, the error got supressed. Try the latest copy. If it doesn't help, try outputting the errors in onError and see if it makes sense.
Sorry meant to say: I only have onApplicationStart, onApplicationEnd, and onRequest enabled (the other methods are commented out)..
Sorry meant to say: I only have onApplicationStart, onApplicationEnd, and onRequest enabled (the other methods are commented out)..
That did it. Guess I didn't have latest copy. Thanks for the great document!
i'm having the same issue... i just copied the pdf and threw it into an Application.cfc file in the root of my app, but no pages appear at all... any suggestions?
Turn on debugging and see if onError is being run. Since my onError is empty, you won't see anything. You should modify it for now to cfdump the exception. Also be 100% sure you get the latest PDF as the first version had a typo.
I did find an error, it was from code i had commented out. now I get a:
Unable to complete CFML to Java translation.
Error information unsupported statement: class
coldfusion.compiler.ASTfunctionDefinition
for code that works when it's in my application.cfm. I've posted it to cf-talk as well.
Just wanted to say thanks. Having a reference from a CF engineer helps with "best practices" scenarios. I don't need to cut-and-paste anything here, but to see the framework certainly helps me out a great deal. Thanks again. :)
I got annoyed with the use of CFABORT causing errors to be thrown and displayed all the time so I wrapped the outputs of my onError method in the following:
<cfif NOT Find("AbortTag.doStartTag",Arguments.Except.RootCause.StackTrace)>..logging and display output..</cfif>
Now I only see real errors.