This repository was archived by the owner on Jan 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
houbie edited this page May 26, 2011
·
3 revisions
The gsp-taglib grails plugin makes it possible to declare tags in a gsp in grails-app/taglib.
Advantages:
- Tags that contain mostly markup, read much better in a gsp. Also, IDE's provide good code completion for markup in gsp's.
- Compared to using templates with the tmpl: tag, tags have a far better performance and better support for code completion.
Example grails-app/taglib/com/acme/label.gsp:
<%@ page import="com.acme.foo.*" %>
<%@ page namespace="my" %>
<%--/**
* @attr code REQUIRED i18n message code
* @attr bind REQUIRED
* @attr styleClass OPTIONAL
*/--%>
<label for="${attrs.bind}" class="label ${attrs.styleClass}">
<g:message code="${attrs.code}"/>
${body()}
</label>
This tag can be used like any other tag:
<my:label code="person.name" bind="person">
<span class="required">*</span>
</my:label>
- Currently the generated groovy code is written in grails-app/taglib and will end up in your VCS. The goal is to load gsp tags dynamic with pre-compilation in war-mode (like gsp's).
- The code is generated by a hacked copy of GroovyPageParser.groovy. GroovyPageParser should be refactored to have more protected members that can be accessed and/or overridden.
- The ultimate goal is to get gsp tags into grails core as first class citizens.