Before you begin
You will need:
Developer access to the ColdFusion or Lucee Administrator.
Access to the server's file system or the ability to modify the
ColdFusionorLuceeconfiguration files.
Create a ColdFusion or Lucee Mapping
Mappings are typically defined in the Application.cfc file or within a specific .cfm or .cfc file to define how the engine resolves paths and objects.
Open your application's main configuration file (typically
Application.cfc).Locate the
mappingsstructure or define a new one.Define the mapping key and the corresponding path or object.
Save the file.
Example Configuration:
<cfset mappings.images = "images/content/"/> <cfset mappings.scripts = "js/scripts/"/>
In this example, the developer can now reference mappings.images instead of the full path.
Confirm the result
To verify the mapping is active:
Create a new
.cfmpage and include theApplication.cfcfile.Use the
dump()function to display the mapping.Example:
<cfdump var="#mappings#">Confirm that the output displays the correct path or value assigned to the mapping.
Limitations
Scope: Mappings defined in
Application.cfcare available globally within the application's scope.Case Sensitivity: Depending on your operating system (e.g., Linux), ensure that the paths defined in your mappings match the actual file system casing.
Persistence: Changes to mappings in
Application.cfcmay require a restart of the ColdFusion or Lucee service to take effect if they are defined at the global level.
