使用 OnError 的 ColdFusion 问题

标签 coldfusion coldfusion-9 coldfusion-10

我正在尝试用 onError 方法(在将替换 application.cfm 的 application.cfc 中)替换我的 cferror 标记(在 application.cfm 中)。 但是我遇到了一个问题。
问题是:

For onError, If i tried to display some user friendly message, it is being displayed in the html at the place where the error is occured.
For example, If exception is occured in the footer, then the message is displayed in the footer of the site and everything else(html) on the site is also displayed.
But when i was using cferror tag, If exception is occured, then only that template is being displayed which is specified in cferror tag.

所以,
有什么方法可以使 onErrorcferror 标签一样工作?
(在显示用户友好消息的意义上)

谢谢。

最佳答案

你说的很有道理。输出缓冲区已经部分填充了对客户端的响应。

在 application.cfc 的 onError 方法中,您应该能够使用 <cfcontent reset=true>清空缓冲区,然后您可以发送您喜欢的任何响应。

关于使用 OnError 的 ColdFusion 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22066204/

相关文章:

coldfusion - cfsetting的ColdFusion 9脚本语法是什么?

regex - 允许在文本字段 Coldfusion 中使用引号

javascript - Coldfusion 9 cflayout 选项卡

coldfusion - 在不知道服务器时间的情况下如何使用 DateDiff?

json - ColdFusion 使用非标准字符解析 JSON

coldfusion - 在 cf9 中循环列表

cookies - 如何在 ColdFusion 10 中覆盖 CFID/CFTOKEN?

sql-server - ColdFusion 10/Windows 7 Pro 64bit 数据源连接验证失败

coldfusion - 如何使用 cfc 对象的引用从另一个函数调用函数?

mysql - 如何在添加记录时插入 id 列表?