【发布时间】:2011-08-11 05:17:42
【问题描述】:
当用户登录 (session.user) 时,我想为相同的 url http://localhost:8080/myapp/ 使用不同的映射
实际上,默认情况下,我m giving the path when the url is "/" to AppController and 'index' action... but if I try to redirect inside the index action when the user is logged to my UserController (also index action), the path changes to @987654322@ . Thats 不是我要找的。p>
有很多网站(twitter、facebook..)都应用了这种方法,但是不明白如何在 Grails 中完成它,而不使用例如相同的操作(AppControlle>index)并呈现不同的视图当用户处于活动状态时。
static mappings = {
"/"(controller:"app",action:"index")
"/$controller/$action?/$id?"{
constraints {
// apply constraints here
}
}
"500"(view:'/error')
"404"(view:'/notFound')
}
【问题讨论】: