如何创建默认值,匹配所有模式?
对于Ex:
"/"(controller: "home", action: "index")
"401"(controller: "error", action: "unauthorized")
"404"(controller: "error", action: "nF")
"500"(controller: "error", action: "err")
当用户点击应用程序http://myapp.com/appName/时,会调用/ mapping。我们如何添加模式以便甚至调用url http://myapp.com/appName(没有fordward斜杠)?
到目前为止,我已尝试执行以下操作:
""(controller: "home", action: "index")
" "(controller: "home", action: "index")
"*"(controller: "home", action: "index")
"*/**"(controller: "home", action: "index")
any(controller: "home", action: "index")
但是所有错误都会产生,其中一些包括:
MissingMethodException: No signature of method: org.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.any() is applicable for argument types:
No signature of method: org.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.*/**() is applicable for argument types:
答案 0 :(得分:1)
模式应始终以正斜杠开头:
"/**"(controller: "home", action: "index")