Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8422637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:30:35+00:00 2026-06-10T03:30:35+00:00

I would like to put all of my CFC into /components folder and be

  • 0

I would like to put all of my CFC into /components folder and be able to call them from different places in application eg. from /forums/index.cfm.

How would I go about setting the mappings?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:30:36+00:00Added an answer on June 10, 2026 at 3:30 am

    Summary…

    There are multiple ways to setup a mapping, and indeed two different types of mapping:

    • A traditional mapping is created via the admin, and can be used anywhere within your CFML code. Railo supports per-context and per-server mappings of this type.

    • There is also a per-application mapping, created either in your Application.cfc or via cfapplication tag, which can be used in most places, but are a runtime construct, so cannot be used at compile-time.

    Also if you have global components, you might want to avoid using a mapping and simply tell Railo where your components are so you can access them directly.

    Creating a per-context mapping:

    Go to the Railo Admin (i.e. http://domain/railo-context/admin/web.cfm ) and in the menu just over half way down you’ll find “Archives & Resources”, within which is “Mappings”.

    In the Virtual column enter /components and in the Resource column enter the absolute path to that directory (e.g. /home/user/public_html/components ), then press the save button.

    You can also create a per-context mapping programmatically, using the cfadmin tag with the action “updateMapping”.

    (Everything here also applies to per-server mappings, except using the Server Admin instead of the Web Admin. Per-server mappings are visible but read-only in the Web Admin interface.)

    Creating a per-application mapping:

    To create a mapping only for a specific application, you can do this in Application.cfc

    Simply create a variable called this.mappings which contains a struct of your virtual and resource values, for example:

    This.Mappings = { '/components' : '/home/user/public_html/components' }
    

    This mapping then will only apply for that application, allowing you to have the same mapping point to different locations for different applications.

    Railo also allows per-application mappings to be created inside Application.cfm, by using the cfapplication tag – like so:

    <cfset MappingStruct = { '/components' : '/home/user/public_html/components' } />
    <cfapplication mappings=#MappingStruct# />
    

    Note: application-level mappings have some restrictions, since they exist at runtime, but not at compile-time (so, for example, they can’t be used for custom tag libraries, where the taglib attribute is evaluated when the template is compiled).

    Referencing a component with a mapping:

    Either of these will enable you to do:

    MyObj = createObject('component','components.NameOfFile').init()
    

    Or:

    MyObj = new components.NameOfFile()
    

    (Note that you don’t use /component/nameoffile like you might when otherwise using a mapping.)

    Global components without a mapping:

    If you want to access the components globally without a mapping, goto the Components section (just below Mappings in the menu), and enter your absolute components path in the “Additional Resources” section. (Leave Trusted unticked.)

    Then you can simply create your objects without the components. mapping being needed:

    MyObj = new NameOfFile()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know how to put all of my ListView rows into
I would like to put all the images that I use in my application
I use jQuery template on my site, I would like to put them all
I'm rendering a form. I would like to put a mark next to all
I would like to put a placeholder into e.g. the footer.html and have it
I would like to put a line All Rights Reserved... at the bottom of
I would like to put newlines in a property value of a manifest. Its
I would like to put a button on top of a Google Map next
I would like to put jQuery at the bottom of the body tag but
I would like to put a time & date stamp on each row added

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.