What is the configuration setting for modifying the default homepage in a Grails application to no longer be appName/index.gsp? Of course you can set that page to be a redirect but there must be a better way.
Add this in UrlMappings.groovy
"/" { controller = "yourController" action = "yourAction" }
By configuring the URLMappings this way, the home-page of the app will be yourWebApp/yourController/yourAction.
(cut/pasted from IntelliGrape Blog)
Edit UrlMappings.groovy
Add for example add this rule, to handle the root with a HomeController.
"/"(controller:'home')
You may try as follows
in the UrlMappings.groovy class which is inside the configuration folder:
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')
}
}
hope this helps,
Rubel
Use controller, view and action parameter by the following syntax:
class UrlMappings {
static mappings = {
"/" (controller:'dashboard', view: 'index', action: 'index')
"500"(view:'/error')
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With