question about coldfusion application names
I installed coldfusion 8 at D:\ColdFusion8.
There are two files D:\ColdFusion8\wwwroot\page1.cfm and D:\ColdFusion8\wwwroot\page2.cfm.
Now my question is if there is no application.cfm开发者_如何学Python or application.cfc at D:\ColdFusion8\wwwroot, should D:\ColdFusion8\wwwroot\page1.cfm and D:\ColdFusion8\wwwroot\page2.cfm be considered as the same application or not?
Strictly speaking, Application.cfm doesn't define an application; cfapplication does. If you include cfapplication in both files and set the same name, then yes they are the same application. If you don't, then the concept of "application" is meaningless -- there are no application-scoped variables (while you can write you are actually just creating a structure in the variables scope, not the application scope).
No, they are not technically in the same application from Coldfusion's point of view without something defining the Application memory scope such as cfapplication or application.cfc. They are just pages residing in the same folder. However, as soon as you add an application.cfc to that folder, they would then become part of the same application, even if they didn't make use of the application scope. When the page is run, the application.cfc would be run as well.
Best practices would encourage you to think of files in the same folder as one application since you may only have one application.cfc in a folder. Down the road you may wish to refactor page1.cfm into "Application A" and page2.cfm into "Application B". This would be very difficult and confusing without moving one of them to another folder.
精彩评论