简体   繁体   English

更改Grails应用程序的默认页面会导致404错误

[英]Changing the default page of grails app results in 404 error

I have a sample grails project and I wanted to change default home page and made changes accordingly to UrlMappings.grrovy file 我有一个示例grails项目,我想更改默认主页并相应地对UrlMappings.grrovy文件进行更改

class UrlMappings {

    static mappings = {
    "/$controller/$action?/$id?"{
        constraints {
            // apply constraints here
        }
    }

//      "/"(view:"/index")
            "/"(controller: "LoginController", action:"/login")
    "500"(view:'/error')
    }
}

Problem is am getting 404 error with the index.gsp not found. 问题是找不到index.gsp 404错误。

What I did was added a new controller which has action login and it gives me this error. 我所做的是添加了一个具有操作登录名的新控制器,它给了我这个错误。 Am using grails 2.2.4 . 我正在使用grails 2.2.4

使用它来映射您的主页:

"/"(controller: "login", action:"login")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM