Grails

Redis: Heavyweight Tags – an awesome use-case for caching with Redis

Redis plugin provides a beautiful way to cache the html tags. Using this plugin we can make big savings on the time taken to render the gsp tags. [java] <redis:memoize key="someKey" expire="3600" > //Some heavy weight tags rendering // Lots of db / network operations. </redis:memoize> ...

by Mohd Farid
Tag: grails taglib
25-Sep-2012

Grails

Using TagLib to avoid changes due to change in URLMappings

Recently, I used Taglib to centralize the effect of URL mapping related changes of my grails application. [java] def userPageLink = {attrs, body -> def user = User.read(attrs.id) out << g.link(controller: 'user', action: 'show', params: [name: user.name]) {body()} } [/java] So wherever I need a link to user page, I...

by Mohd Farid
Tag: grails taglib
14-Feb-2011

Grails, Javascript/Ajax/JQuery

Grails taglib and JavaScript file

We use internationalization feature in grails using message tag in GSP pages. However arbitrary Groovy/Grails (e.g. tags) code can not be used in JavaScript as they are not executed on server side. To overcome this I used the following way : Declare a JSON object in js file or any where else so that this object is global one. Create a...

by Bhagwat Kumar
Tag: grails taglib
16-Jan-2011

Grails

Test Link

(based on Tomás Lin’s truthlink) This is useful when one requires link on certain condition. Instead of first using condition tag and then tag for link these can be combined into one using taglib. text or Text Other way of doing this is by using taglib. class...

by Hitesh Bhatia
Tag: grails taglib
19-Apr-2010