将Grails应用程序中的默认主页修改为不再是appName/index.gsp的配置设置是什么?当然,您可以将该页面设置为重定向,但必须有更好的方法.
Bob*_*ann 57
在UrlMappings.groovy中添加此内容
"/" {
controller = "yourController"
action = "yourAction"
}
通过这种方式配置URLMappings,应用程序的主页将是yourWebApp/yourController/yourAction.
(从IntelliGrape博客剪切/粘贴)
Ras*_*bel 11
您可以
在配置文件夹中的UrlMappings.groovy类中尝试以下操作:
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?"{
constraints {
// apply constraints here
}
}
//"/"(view:"/index")
"/" ( controller:'Item', action:'index' ) // Here i have changed the desired action to show the desired page while running the application
"500"(view:'/error')
}
}
Run Code Online (Sandbox Code Playgroud)
Rubel ,希望这会有所帮助