¿Cómo puedo usar createLink() para crear un enlace a la raíz de mi proyecto Grails?Grails createLink to project root?
Respuesta
Trate
createLink(absolute : 'true')
Esto debería apuntar a http://localhost:8080/yourproject/
(el valor predeterminado establecido)
puede especificar un uri
de '/'
:
<a href="${createLink(uri: '/')}">link text</a>
That drops the host and protocol information. –
Right - it's relative to the running app. If you need a link that works outside of the app make it absolute: 'link text' –
normal Sí, en un momento más claro, me acabo de dar cuenta de eso, y luego volví aquí. Lo intentaré hoy, gracias! –
utilizo este código:
<g:link uri="/">Home</g:link>
- 1. Grails: cómo usar createLink en un filtro?
- 2. Cómo anular el comportamiento estándar de ApplicationTagLib # createLink yg: ¿enlace?
- 3. ¿Qué especifico para "Rope project root folder:." Con archivos python y el complemento RopeVim?
- 4. ¿Cómo manejar Many-To-Many en Grails sin belongsTo?
- 5. Play Framework como SBT Non-Root Module
- 6. Symfony2: configuración personalizada root
- 7. Pass Javascript variable en el método CreateLink Griales llamada
- 8. Microsoft Project
- 9. Asp.net Project Ideas?
- 10. Instalar Python 2.7 sin root
- 11. Sugerencias para Grails .gitignore
- 12. Oprimir privilegios de root
- 13. Calcular nth root?
- 14. PHP secure root
- 15. Root Nodes en JSON
- 16. ManagementScope y "root \ cimv2"?
- 17. Cómo encontrar Root UIViewController
- 18. xampp change document root
- 19. java.sql.SQLException: Schema 'ROOT' no existe
- 20. ¿Cómo mostrar la imagen en grails GSP?
- 21. LINQ to XML GroupBy
- 22. Grails: Alternativas al Doc Grails?
- 23. Python 3 Project Initialization/Prototyping
- 24. ¿Puedo usar la etiqueta Grails fuera de GSP?
- 25. Grails JQuery Ajax Form Validation
- 26. Maven Run Project
- 27. Eclipse Web Project Dependencies
- 28. MVC 3 project structure
- 29. Agile Project Management
- 30. Scheme Project Ideas
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. –
Desde su gsp, también puede usar '$ {request.contextPath}' en un '' – ccheneson