Reputation: 93491
The question title is enough to explain excepting the attempts that i try :
<g:link controller="staff" action="all" <g:if test="${actionName=='all' }">class="active"</g:if> >Overview</g:link>
Error 500
Class :org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException Message Grails tag [g:link] was not closed
<g:link controller="staff" action="all" class="<g:if test="${actionName=='all' }">active</g:if>" >Overview</g:link>
Error 500 Class org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException Message Attribute value must be quoted (controller="staff" action="all" class="
X(in this example)= active
Upvotes: 2
Views: 722
Reputation: 4373
I think It will be sufficient if you will use ternary operator e.g:
<g:link controller="staff" action="all" class="${actionName == 'all' ? 'active' : ''}">
Overview
</g:link>
Upvotes: 5