createLinkTo

Purpose

Creates a link that can be used where necessary (for example in an href, javascript, ajax call etc.)

Examples

Example controller for an application called "shop":

Example usages for the "shop" app:

<g:createLinkTo dir="css" file="main.css" /> == /shop/css/main.css
<g:createLinkTo dir="css" file="main.css" absolute="true"/> == http://portal.mygreatsite.com/css/main.css
<g:createLinkTo dir="css" file="main.css" base="http://admin.mygreatsite.com"/> == http://admin.mygreatsite.com/css/main.css

Example as a method call in GSP only:

<link type="text/css" href="${createLinkTo(dir:'css',file:'main.css')}" />

Results in:

<link type="text/css" href="/shop/css/main.css" />

Description

Attributes

Source

Show Source