将cferror标记重构为application.cfc的onError() [英] refactor cferror tag to application.cfc's onError()

查看:99
本文介绍了将cferror标记重构为application.cfc的onError()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何翻译

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

到Application.cfc的onError()函数?请注意,cferror为模板创建了一个var error结构.有没有一种快速简便的方法来创建相同的错误结构?如何使用<cfinclude>将其传递给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>?

我知道onRequest()与目标页面共享变量范围,但是onError也共享变量范围吗?如果没有,我该怎么办?坚持到Form范围吗?

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?

谢谢

推荐答案

根据 http://livedocs.adobe.com/coldfusion/8/htmldocs/appFramework_15.html

考虑用onError事件方法替换cferror标记.如果你 不要这样做,请将cferror标记放在CFC初始化代码中.

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

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

如果使用的是Application.cfc,该怎么办?要记住的一件事是 您可以轻松地将CFERROR标记放入您的 Application.cfc文件.这是允许的,而我之前已经做过.

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.

这篇关于将cferror标记重构为application.cfc的onError()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆