我正在尝试用 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.
所以,
有什么方法可以使 onError 与 cferror 标签一样工作?
(在显示用户友好消息的意义上)
谢谢。
最佳答案
你说的很有道理。输出缓冲区已经部分填充了对客户端的响应。
在 application.cfc 的 onError 方法中,您应该能够使用 <cfcontent reset=true>
清空缓冲区,然后您可以发送您喜欢的任何响应。
关于使用 OnError 的 ColdFusion 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22066204/