Question: I'm using twitter bootstrap with grails and have the following in my layout:

```
        <div class="nav-collapse">
            <ul class="nav">
                <li><a href="${createLink(uri: '/request/new')}">My Link</a></li>
            </ul>
        </div>

```

On my page I have the following:

```
<html>
    <head>
        <meta name="layout" content="bootstrap">
    </head>

    <body>
        sometext
    </body>
</html>

```

**Question**

In my layout how do I detect when the `My Link` action is clicked? so that I can highlight it using `class="active"`

Answer: 
Use actionName and controllerName to know in which action you are.

```
    <div class="nav-collapse">
        <ul class="nav">
            <li ${controllerName == 'request' && actionName == 'new' ? 'class="active"' : ''}><a href="${createLink(uri: '/request/new')}">My Link</a></li>
        </ul>
    </div>

```

By the way, I suggest you to use `g:link` instead of `g:createLink` where it is possible. Here : 

```
    <div class="nav-collapse">
        <ul class="nav">
            <li ${controllerName == 'request' && actionName == 'new' ? 'class="active"' : ''}><g:link controller="request" action="new">My Link</g:link></li>
        </ul>
    </div>

```
Change your layout gsp to:

```
<div class="nav-collapse">
    <ul class="nav">
        <li onclick="javascript: this.setAttribute("class","active");">
            <g:remoteLink controller='request' action='new' update='data'>My Link</g:remoteLink>
        </li>
    </ul>
</div>
<div id="data">
    <g:layoutBody />
</div>

```