我想用一個不同的映射爲相同的URL http://localhost:8080/myapp/當用戶(session.user)登錄不同的映射爲相同的URL
其實,默認我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 http://localhost:8080/myapp/user/index . That
不是什麼我在找對於。
有很多應用此方法的網站(twitter,facebook ..),但無法理解它如何在Grails中完成,而不使用相同的動作(例如AppControlle> index)並渲染不同用戶活動時的視圖。
static mappings = {
"/"(controller:"app",action:"index")
"/$controller/$action?/$id?"{
constraints {
// apply constraints here
}
}
"500"(view:'/error')
"404"(view:'/notFound')
}