Grails默认首页的修改

有些人使用IDEA开发Grails,开发阶段使用Grails自带的默认首页可以方便我们开发,但是开发结束后想要修改默认的首页,如何修改呢?

1.打开grails-app 文件下conf下的UrlMappings.groovy可以看到如下

 1 class UrlMappings {
 2     static mappings = {
 3       "/$controller/$action?/$id?"{
 4           constraints {
 5              // apply constraints here
 6           }
 7       }
 8       "/"(view:"/index")
 9       "500"(view:'/error')
10     }
11 }

只要修改相应路径即可更改主页,如

class UrlMappings {
    static mappings = {
      "/$controller/$action?/$id?"{
	      constraints {
			 // apply constraints here
		  }
	  }
      "/"(view:"/login/login")
	  "500"(view:'/error')
	}
}

  

原文地址:https://www.cnblogs.com/xiaoyangyi/p/6236648.html