Grails 我想提供一个链接,返回404上的上一页
我有一个ErrorController,可以处理各种应用程序错误,如404、500等。在这些操作中,我呈现适当的错误页面。我希望能够在这些错误页面上提供一个链接,在收到错误之前将用户带回该页面 我尝试获取HTTP_REFERER头,但它始终为空。request.forwardURI提供导致错误的当前请求 建议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
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()">