Grails 1.3.7 为控制器选择了错误的视图

发布于 2024-12-19 07:23:07 字数 798 浏览 0 评论 0原文

我有一个名为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

向地狱狂奔 2024-12-26 07:23:07

同意@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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文