Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Grails 我想提供一个链接,返回404上的上一页_Grails_Http Status Code 404 - Fatal编程技术网

Grails 我想提供一个链接,返回404上的上一页

Grails 我想提供一个链接,返回404上的上一页,grails,http-status-code-404,Grails,Http Status Code 404,我有一个ErrorController,可以处理各种应用程序错误,如404、500等。在这些操作中,我呈现适当的错误页面。我希望能够在这些错误页面上提供一个链接,在收到错误之前将用户带回该页面 我尝试获取HTTP_REFERER头,但它始终为空。request.forwardURI提供导致错误的当前请求 建议 class ErrorController { def notFound() { def backToPage = getPreviousPage // help here

我有一个ErrorController,可以处理各种应用程序错误,如404、500等。在这些操作中,我呈现适当的错误页面。我希望能够在这些错误页面上提供一个链接,在收到错误之前将用户带回该页面

我尝试获取HTTP_REFERER头,但它始终为空。request.forwardURI提供导致错误的当前请求

建议

class ErrorController {
  def notFound() {
    def backToPage = getPreviousPage // help here
    render view: '404', mode: [backToPage: backToPage]
  }
}
你可以用


函数goBack(){
window.history.back()
}
<script>
    function goBack() {
        window.history.back()
    }
</script>

<input type="button" value="Back" onclick="goBack()">