主题:  紧急求助:关于CFMX的错误处理问题!

my0707

职务:普通成员
等级:1
金币:0.0
发贴:6
注册:2003/11/13 8:56:33
#12003/11/15 16:40:35
想知道在CF-MX里如何设置错误处理页面

在CF4的教程里说在Application.html中设置CFERROR标签,可我在CFMX里怎么也找不到Application.html文件。

是不是MM把这个文件用别的文件代替了?有谁知道吗?

小弟拜谢了!!!



雅痞公子

职务:普通成员
等级:3
金币:-3.0
发贴:732
注册:2003/3/27 23:16:34
#22003/11/15 21:23:26
Application.cfm是开发中很重要的文件。
当然这个文件得你自已写,且得把文件名保存为Application.cfm
而不是Application.html.
通常Application.cfm都是放一些在同目录或子目录中共享的变量,
把CFERROR标签放在Application.cfm文件里就能保证任何一个页面出现错误,ColdFusion就显示cferror里指定的文件。

比如就新建一个文件:

文件名保存为Application.cfm:

然后在同目录或子目录的文件中就都可以引用”cfml“这个变量:
#cfml#
因为ColdFusion在运行一个页面时会先俭查同目录当中有没有Application.cfm这个文件,有就包括在页面的头部,
没有就到父目录当中找。

Application.cfm文件很重要的一个功能就是可以起用Sesssion,Client,Application等变量,使别的文件可以使用这些变量
如:
<---下面的内容应该放在Application.cfm文件里--->




7yue_5d

职务:普通成员
等级:1
金币:0.0
发贴:32
注册:2003/4/1 13:24:33
#32003/11/20 17:40:41
给你推荐一个程序。DRK3里有一个xml news聚合器。
里面有2个文件,其中一个是_error.cfm。
这个错误掷出可以说是我见过的最强的错误帮助显示,加上cfmx admin中勾选上enable debugging,两者结合。横扫CFMX所有错误。调试代码爽到家。
这个是application.cfm中的定义代码:


下面是_error.cfm的代码:





    

        Cannot Find the Path Specified

        Make sure you have configured the correct file paths for your installation in the Application.cfm template. Your current settings for these variables are:



    




    

        Cannot Find the Template Specified

        Make sure you have configured the correct package path for components in this instalation. This setting is made in your Application.cfm template. Your current setting for this variable is:


application.packagepath: #application.packagepath#
    















不信你试试,抓错一绝。