2012-02-22 7 views

Respuesta

3

Trate

createLink(absolute : 'true') 

Esto debería apuntar a http://localhost:8080/yourproject/ (el valor predeterminado establecido)

+1

Eso es lo que yo pensaría, pero no está haciendo el truco. Usando Grails 1.3.7 y 2.0.1, después de crear una nueva aplicación y generar un controlador llamado "Info", con def index = {render createLink (absolute: 'true')}, veo esto: http: // localhost: 8080/myproject/info/index. –

+1

Desde su gsp, también puede usar '$ {request.contextPath}' en un '' – ccheneson

28

puede especificar un uri de '/':

<a href="${createLink(uri: '/')}">link text</a> 
+0

That drops the host and protocol information. –

+2

Right - it's relative to the running app. If you need a link that works outside of the app make it absolute: 'link text' –

+0

normal Sí, en un momento más claro, me acabo de dar cuenta de eso, y luego volví aquí. Lo intentaré hoy, gracias! –

4

utilizo este código:

<g:link uri="/">Home</g:link>