开发者

refactor cferror tag to application.cfc's onError()

How to translate

<cferror type="EXCEPTION" template="ErrorTemplate.cfm">

to an onError() function for Application.cfc? Notice that cferror create a var error struct for the template. Is there a quick and easy way to create the same error struct? How to pass that into ErrorTemplate.cfm using <cfinclude>? 开发者_如何转开发

I know onRequest() shares the variable scope with the target page, but does onError share variables scope too? If not, what shall I do? Stick it to the Form scope?

Thank you


According to http://livedocs.adobe.com/coldfusion/8/htmldocs/appFramework_15.html

Consider replacing cferror tags with an onError event method. If you do not do so, put the cferror tags in the CFC initialization code.

According to http://www.coldfusionjedi.com/index.cfm/2007/12/5/The-Complete-Guide-to-Adding-Error-Handling-to-Your-ColdFusion-Application

What if you are using Application.cfc? Well one thing to remember is that you can just as easily put CFERROR tags inside your Application.cfc file. That is allowed, and I've done that before.


Why would you not just use onError in App.cfc to display a "Sorry and error occurred, we are working on it" type page?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜