Grails 404 UrlMapping 的问题 [英] Problems with Grails 404 UrlMapping
问题描述
我在让 Grails 将我的 404 错误映射到文档中的错误控制器时遇到了一些问题.我正在运行 Grails 1.3.5,当我将以下映射添加到默认应用程序时:
I'm having some problems getting Grails to map my 404 errors to an errors controller like in the documentation. I'm running Grails 1.3.5 and when I add the following mapping to a default application:
404"(控制器:'错误',动作:'notFound')
"404" (controller:'errors', action:'notFound')
它适用于映射 500 错误但不适用于 404 错误.我似乎记得以前有过这个问题,它与 Tomcat(vs Jetty)有关,但我不记得有什么修复方法,或者我认为它现在可能已经解决了.
It works for mapping 500 errors but not 404's. I seem to recall having this problem before and it being related to Tomcat (vs Jetty) but I don't remember a fix or I thought it might have been resolved by now.
我尝试访问未定义的资源,如 http://localhost:8080/appName/controllerName/blah 而我得到的只是默认的 Tomcat 404.
I try accessing a resource that's not defined like http://localhost:8080/appName/controllerName/blah and all I get is the default Tomcat 404.
我正在做一个标准的 grails run-app 来测试并尝试让它工作.
I'm doing a standard grails run-app for testing and trying to get it to work.
推荐答案
删除空格后,问题解决
404"(控制器:'错误',动作:'notFound')
"404"(controller:'errors', action:'notFound')
这篇关于Grails 404 UrlMapping 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!