Upgrade to Grails 2.0: /index.gsp not found

五迷三道 提交于 2019-12-13 02:36:16

问题


I have upgraded from Grails 1.3.7 to 2.0.0.RC1:

After sorting out a lot of issues with depdendencies I have finally managed to start my Grails application but when browsing to URL it tell me I receive the following:

GroovyPagesServlet:  "/index.gsp" not found

It worked perfectly before... where is it looking for it?

Thanks

Jonas


回答1:


ok, I figured it out. The above syntax in UrlMappings.groovy does not work. It must be:

"/" {
  controller = "user"
  action = "login"
}



回答2:


As I add SecurityFilters.groovy due to official docs, the same thing happens. Tomcat show error: "/index.gsp" not found Please see also: http://grails.org/doc/latest/guide/theWebLayer.html#filterTypes

class SecurityFilters {
   def filters = {
       loginCheck(controller: '*', action: '*') {
           before = {
              if (!session.user && !actionName.equals('login')) {
                  redirect(action: 'login')
                  return false
               }
           }
       }
   }
}

Actually, I think the official doc make a mistake. After

redirect(action: 'login')

it should be

return true



回答3:


Edit UrlMappings.groovy, add this,eg: /errorInfo.gsp (view: /errorInfo)

ref from : http://grails.1312388.n4.nabble.com/Direct-linking-to-gsp-in-Grails-2-0-td4228929.html



来源:https://stackoverflow.com/questions/8089592/upgrade-to-grails-2-0-index-gsp-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!