2008-05-19

Grails不支持Controller的url加包名?

关键字: grails controller package url urlmappings
我使用
grails create-controller user
grails create-controller admin.user
创建了2个Controller
grails-app\controllers\UserController.groovy
grails-app\controllers\admin\UserController.groovy


本想能自动映射到下面的URL
http://localhost:8080/myapp/user
http://localhost:8080/myapp/admin/user

但是不行,尝试修改grails-app/conf/UrlMappings.groovy
class UrlMappings {
    static mappings = {
    	"/admin/user/$action?/$id?" (controller:"admin.user")
    }
}

但还是不行。

google只找到相关文章
http://jira.codehaus.org/browse/GRAILS-221
http://jira.codehaus.org/browse/GRAILS-1243
http://grails.org/URL+mapping
评论
wangcheng 2008-05-21
你的意思是
AdminUserController.groovy
# static mappings = {
# "/admin/$c/$action?/$id?" (controller:"admin$c")
# }
然后url是/admin/user/show/111
这样吗?
山风小子 2008-05-20
把admin\UserController.groovy改为AdminController.groovy

controller:"admin"就可以了
发表评论

您还没有登录,请登录后发表评论