Grails Redirect

I am admittedly still a newbie at Grails and am self learning without aid of a book, hence the simplicity of this post. After I finished the current application I am working on the last step was to get the root index.gsp page to redirect to something more useful. So I went through the user guide to find the directive for a redirect, only to find there was none, at least at a glance.

Grails gsp pages are an extension of a jsp page, meaning they are servlet backed. The grails API exposes the session, servletContext, request, and response to all gsp pages. This means that redirecting is as simple as using the sendRedirect method on the response.

${response.sendRedirect("myController/myAction")}

About the author

Jason McDonald

View all posts

4 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.