Components stored in the same directory are members of a component package. Component packages help prevent naming conflicts, and facilitate easy component deployment; for example:
access="package"
attribute in a method's cffunction tag, access to the method is limited to components in the same package. Components in other packages cannot use this method, even if they specify it with a fully qualified component name. For more information on access security, see Using access security.
<!--- Create the component instance. ---> <cfobject component="appResources.components.tellTime2" name="tellTimeObj"> <!--- Invoke the methods. ---> <cfinvoke component="#tellTimeObj#" method="getLocalTime" returnvariable="localTime" > <cfinvoke component="#tellTimeObj#" method="getUTCTime" returnvariable="UTCTime" > <!--- Display the results. ---> <h3>Time Display Page</h3> <cfoutput> Server's Local Time: #localTime#<br> Calculated UTC Time: #UTCTime# </cfoutput>
You use dot syntax to navigate directory structures. Place the directory name before the component name.
The following example shows a CFScript invocation:
<cfscript> helloCFC = createObject("component", "appResources.components.catQuery"); helloCFC.getSaleItems(); </cfscript>
The following example shows a URL invocation:
http://localhost/appResources/components/catQuery.cfc?method=getSalesItems