error creating a custom tag library in Grails

grails, gsp, taglib

Solution

Remove

static defaultEncodeAs = 'html'

since that's escaping your output.

Problem

I was trying out a simple use of grails tag library. I created a simple tag library called isowner ``` class AuthTagLib { static defaultEncodeAs = 'html' def springSecurityService def isOwner = { attrs, body -> def loggedInUser = springSecurityService.currentUser def owner = attrs?.owner if(loggedInUser?.id == owner?.id) { out << body() } }} ``` Then tried using it with the gsp as : ``` <g:isOwner owner="${leaveFormInstance.employee}"> <g:link class="edit" action="edit" resource="${leaveFormInstance}"> <g:message code="default.button.edit.label" default="Edit" /> </g:link> </g:isOwner> ``` Now it was supposed to take a user object as input and validate if user is the owner of the post. Now everything works fine but in the output html it displays the link as a text. I am new with this stuff and must be missing some basics can you help.

Original source