我在處理grails 1.3.6中的404 HTTP響應時出現了一個奇怪的問題(同樣的錯誤行爲在1.3.5中)。它有時可以工作,但大部分時間沒有。我認爲這是一個Grails錯誤,但沒有發現任何錯誤在Grails的jira .. 每當我請求錯誤的URL我收到默認的Tomcat 404頁面。 我的配置/ UrlMappings.groovy樣子:404的Grails URLMappings無法正常工作
class UrlMappings {
static mappings = {
"404" {
controller = 'customError'
action = 'index'
code = 404
}
"500" {
controller = 'customError'
action = 'index'
code = 500
}
"/"(controller: "home", action: "index")
"/$controller/$action?/$id?"{
constraints {
// id has to be a number
id(matches: /\d+/)
}
}
}
}
隱而不宣有人知道如何解決它:-)
最佳, 刁
有了這個括號{}它有時也可以。使用正常的括號,它似乎每次都有效。問題是我必須將代碼參數發送到控制器中。你知道如何使用正常的括號發送它。 「params:[...]」聲明不起作用...... – kuceram 2011-02-07 21:31:59