class UrlMappings {
static mappings = {
"/$id/$name"{
controller = "page"
action = "view"
}
"500"(view:'/error')
"/"(controller:"index")
}
}
Witch正在工作,但....内容不会在urlbar中清除,所以我第一次点击链接一切顺利:http://localhost:8080/SuurdGasControl/2/Gasmetingen
但是下一页显示:http://localhost:8080/SuurdGasControl/2/6/Ontgassen
请注意,ID“2”尚未删除...
任何帮助或想法?
更新
URLMapping现在看起来像这样:
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?"{
constraints {
// apply constraints here
}
}
name stfu: "/id/$id/$name" {
controller = 'page'
action = 'view'
}
"500"(view:'/error')
"/"(controller:"index")
}
}
创建链接非常简单:
<g:link mapping="stfu" params="[id: pageId, name: pageName]">${oNavigationInstance.toString()}</g:link>
答案 0 :(得分:3)