Search code examples
grailsgsp

Creating a back link using Grails


I need to do "back" link in gsp page. How to realize it without using controllers and actions? For example via history-stack.


Solution

  • sounds like a javascript question rather than gsp...

    <a href="#" onclick="javascript:window.history.back();">Back</a> 
    

    If you were really using grails you could do something like this

    Controller:

    def prevLoc=request.getHeader('referer')
    

    gsp:

    <a href="# onclick="javascript:window.location.replace('${prevLoc}');">Back</a><