Reputation: 149
My requirement is, I'm having a gsp where using a <g:if>
tag I'm checking for a condition.
If that condition satisfies, then I have to redirect the control automatically to an action in a controller.
How I can achieve this?
Thanks in advance.
Upvotes: 1
Views: 2619
Reputation: 3776
I have done similar things.
I did it using a custom tag that had a closure checking if for example a logged in user had a certain role or something, then you can do the redirect from your closure.
The you just put the tag in you gsp-page.
Upvotes: 0
Reputation: 35951
You can use JavaScript like:
<g:if ...>
<g:javascript>
window.location.href = '<g:createLink ... >';
</g:javascript>
</g:if>
Btw, it's much easier and better to do it in controller itself.
Upvotes: 3