Groovy Documentation

org.codehaus.groovy.grails.plugins.web.taglib
[Groovy] Class ApplicationTagLib

java.lang.Object
  org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib
All Implemented Interfaces:
ApplicationContextAware, InitializingBean

class ApplicationTagLib

The base application tag library for Grails many of which take inspiration from Rails helpers (thanks guys! :) This tag library tends to get extended by others as tags within here can be re-used in said libraries

Authors:
Graeme Rocher


Property Summary
static java.lang.Object SCOPES

ApplicationContext applicationContext

java.lang.Object cookie

Obtains the value of a cookie.

java.lang.Object createLink

Creates a grails application link from a set of attributes.

java.lang.Object createLinkTo

Creates a link to a resource, generally used as a method rather than a tag.

java.lang.Object grailsUrlMappingsHolder

java.lang.Object header

Renders the specified request header value.

java.lang.Object join

Uses the Groovy JDK join method to concatenate the toString() representation of each item in this collection with the given separator.

java.lang.Object link

General linking to controllers, actions etc.

java.lang.Object meta

Output application metadata that is loaded from application.properties.

GrailsPluginManager pluginManager

java.lang.Object resource

Creates a link to a resource, generally used as a method rather than a tag.

java.lang.Object set

Sets a variable in the pageContext or the specified scope.

boolean useJsessionId

java.lang.Object withTag

Helper method for creating tags called like:

    withTag(name:'script',attrs:[type:'text/javascript']) {
    ...
    }
 
attr:
name REQUIRED the tag name
@attr attrs tag attributes

 
Method Summary
void afterPropertiesSet()

java.lang.String makeServerURL()

Get the declared URL of the server from config, or guess at localhost for non-production.

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Property Detail

SCOPES

static final java.lang.Object SCOPES


applicationContext

ApplicationContext applicationContext


cookie

java.lang.Object cookie
Obtains the value of a cookie.
attr:
name REQUIRED the cookie name


createLink

java.lang.Object createLink
Creates a grails application link from a set of attributes. This link can then be included in links, ajax calls etc. Generally used as a method call rather than a tag eg.
<a href="${createLink(action:'list')}">List</a>
attr:
controller The name of the controller to use in the link, if not specified the current controller will be linked
attr:
action The name of the action to use in the link, if not specified the default action will be linked
attr:
uri relative URI
attr:
url A map containing the action,controller,id etc.
attr:
base Sets the prefix to be added to the link target address, typically an absolute server URL. This overrides the behaviour of the absolute property, if both are specified.
attr:
absolute If set to "true" will prefix the link target address with the value of the grails.serverURL property from Config, or http://localhost:<port> if no value in Config and not running in production.
attr:
id The id to use in the link
attr:
fragment The link fragment (often called anchor tag) to use
attr:
params A map containing URL query parameters
attr:
mapping The named URL mapping to use to rewrite the link
attr:
event Webflow _eventId parameter


createLinkTo

java.lang.Object createLinkTo
Creates a link to a resource, generally used as a method rather than a tag.
eg. <link type="text/css" href="${createLinkTo(dir:'css',file:'main.css')}" />


grailsUrlMappingsHolder

java.lang.Object grailsUrlMappingsHolder


header

java.lang.Object header
Renders the specified request header value.
attr:
name REQUIRED the header name


join

java.lang.Object join
Uses the Groovy JDK join method to concatenate the toString() representation of each item in this collection with the given separator.
attr:
REQUIRED in The collection to iterate over
attr:
delimiter The value of the delimiter to use during the join. If no delimiter is specified then ", " (a comma followed by a space) will be used as the delimiter.


link

java.lang.Object link
General linking to controllers, actions etc. Examples:
<g:link action="myaction">link 1</gr:link>
<g:link controller="myctrl" action="myaction">link 2</gr:link>
attr:
controller The name of the controller to use in the link, if not specified the current controller will be linked
attr:
action The name of the action to use in the link, if not specified the default action will be linked
attr:
uri relative URI
attr:
url A map containing the action,controller,id etc.
attr:
base Sets the prefix to be added to the link target address, typically an absolute server URL. This overrides the behaviour of the absolute property, if both are specified.
attr:
absolute If set to "true" will prefix the link target address with the value of the grails.serverURL property from Config, or http://localhost:<port> if no value in Config and not running in production.
attr:
id The id to use in the link
attr:
fragment The link fragment (often called anchor tag) to use
attr:
params A map containing URL query parameters
attr:
mapping The named URL mapping to use to rewrite the link
attr:
event Webflow _eventId parameter
attr:
elementId DOM element id


meta

java.lang.Object meta
Output application metadata that is loaded from application.properties.
attr:
name REQUIRED the metadata key


pluginManager

GrailsPluginManager pluginManager


resource

java.lang.Object resource
Creates a link to a resource, generally used as a method rather than a tag.
eg. <link type="text/css" href="${resource(dir:'css',file:'main.css')}" />
attr:
base Sets the prefix to be added to the link target address, typically an absolute server URL. This overrides the behaviour of the absolute property, if both are specified.x≈
attr:
contextPath the context path to use (relative to the application context path). Defaults to "" or path to the plugin for a plugin view or template.
attr:
dir the name of the directory within the grails app to link to
attr:
file the name of the file within the grails app to link to
attr:
absolute If set to "true" will prefix the link target address with the value of the grails.serverURL property from Config, or http://localhost:<port> if no value in Config and not running in production.
attr:
plugin The plugin to look for the resource in


set

java.lang.Object set
Sets a variable in the pageContext or the specified scope.
attr:
var REQUIRED the variable name
attr:
value the variable value; if not specified uses the rendered body
attr:
scope the scope name; defaults to pageScope


useJsessionId

boolean useJsessionId


withTag

java.lang.Object withTag
Helper method for creating tags called like:
    withTag(name:'script',attrs:[type:'text/javascript']) {
    ...
    }
 
attr:
name REQUIRED the tag name
attr:
attrs tag attributes


 
Method Detail

afterPropertiesSet

void afterPropertiesSet()


makeServerURL

java.lang.String makeServerURL()
Get the declared URL of the server from config, or guess at localhost for non-production.


 

Groovy Documentation