[Grails] 如何自定义首页的urlmapping

zengsun 2007-07-12
在grails-app/conf/*UrlMappings.groovy文件中定义了应用的URL映射规则:
class GForumUrlMappings {
    static mappings = {
        "/$controller/$action?/$id?"{
            constraints {
                // apply constraints here
            }
        }
     }	
}

我现在不想使用默认的首页index.jsp或index.gsp。但是设置web.xml没有用处!
不是非要在index.jsp或index.gsp使用response对象的重定向功能吧!
zengsun 2007-07-12
用这个没有用:
class GForumUrlMappings {
    static mappings = {
        "/$controller/$action?/$id?"{
            constraints {
                // apply constraints here
            }
        }
        // Custom URL Mapping
        "/index" {
            controller = "category"
            action = "list"
        }
        


    }	
}

山风小子 2007-07-12
The urlmapping is broken in the Grails0.5.6.
But the issue seems to be fixed now.
Check out the latest snapshot of Grails and try again.
addday 2007-11-21
我是这么解决的。

${response.sendRedirect(request.contextPath + "/index")}
Javabengou 2008-05-11
# "/" { 
#             controller = "category" 
#             action = "list" 
#         } 
Javabengou 2008-05-11
其实文档里说的很清楚该怎么样映射
Global site tag (gtag.js) - Google Analytics