Grails 1.3.7 为控制器选择了错误的视图
我有一个名为 LoginController 的控制器,其操作为 auth:
class LoginController {
def auth = {
render view: 'auth'
}
}
所以我转到 URL http://localhost:8080/myapp/ login/auth,并想查看我的视图“/login/auth.gsp”。但我收到以下错误:
type Status report
message /myapp/WEB-INF/grails-app/views/jobSearch/auth.jsp
description The requested resource (/myapp/WEB-INF/grails-app/views/jobSearch/auth.jsp) is not available.
似乎 grails 由于某种原因解析了错误的视图名称。你知道发生了什么事吗?
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?"{
constraints { // apply constraints here }
}
"/"(view:"/index") "500"(view:'/error')
}
}
I have controller named LoginController with action auth:
class LoginController {
def auth = {
render view: 'auth'
}
}
So I go to the URL http://localhost:8080/myapp/login/auth, and want to see my view '/login/auth.gsp'. But I get the following error:
type Status report
message /myapp/WEB-INF/grails-app/views/jobSearch/auth.jsp
description The requested resource (/myapp/WEB-INF/grails-app/views/jobSearch/auth.jsp) is not available.
Seems that grails resolves wrong view name for some reason. Do you know, what's going on?
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?"{
constraints { // apply constraints here }
}
"/"(view:"/index") "500"(view:'/error')
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
同意@omarello,看起来像是将登录控制器 URL 映射到“jobsearch”。与 JSP 相关的错误消息是当找不到匹配的 gsp 页面并尝试回退到 JSP 时发生的情况。
Agree with @omarello, something looks like its mapping the login controller URL to 'jobsearch'. The error message relating to JSP is what happens when it can't find a matching gsp page and tries to fallback to JSP.