Returns path to the JEE server context root for the current request.


The path from the web root to the context root for the current page. The path starts with a forward slash character (tick) but does not end with a forward slash character (tick). For applications in the default (root) context, returns the empty string.


System functions


ColdFusion MX 7: Added this function.

Function syntax


See also



This function is equivalent to calling GetPageContext().GetRequest().GetContextPath(). On JEE configurations, it returns the path from the Web root to the JEE context root of the ColdFusion JEE application. On server configurations, it returns the empty string, because the context root is at the web root.This function is useful in applications that might be installed at varying JEE context roots.


The ColdFusion Administrator uses the following line to get the location of the administrator directory:

<cfset request.thisURL = "#getContextRoot()#/CFIDE/administrator/">

The Administrator uses the returned value in places where it uses a URL to access Administrator resources, such as images, as in the following line:

<a href="index.cfm"><img src="#request.thisURL#images/back.gif" width="16"
height="16" border="0" alt=" "></a>


This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy