In your views, layouts and handlers you can use the buildLink method provided by the request context object (event) to build routable links in your application.
/** * Builds links to events or URL Routes * * @to The event or route path you want to create the link to * @queryString The query string to append which can be a regular query string string, or a struct of name-value pairs * @translate Translate between . to / depending on the SES mode on to and queryString arguments. Defaults to true. * @ssl Turn SSl on/off on URL creation, by default is SSL is enabled, we will use it. * @baseURL If not using SES, you can use this argument to create your own base url apart from the default of index.cfm. Example: https://mysample.com/index.cfm
*/string functionbuildLink( to, queryString ="", boolean translate =true, boolean ssl, baseURL =""){
Just pass in the routed URL or event and it will create the appropriate routed URL for you:
Please note that the to argument can be a simple route path, but it can also be a struct. This struct is for routing to named routes. Even though we recommend to use the route() method instead.