2
我在webapp/test文件夹中有一个index.html页面。如果我去localhost:8080/test/index.html路径,页面呈现,但如果我去localhost:8080 /测试/它给我找不到页面错误。什么是实现这一目标的正确途径?在我的UrlMappings.groovy中,我没有任何运气尝试过这些口味。在路由到webapp文件夹时,将默认渲染文件设置为grails 3中的index.html
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?(.$format)?" {
constraints {
// apply constraints here
}
}
/* TRIED THESE
"/"(view: "/index.html")
"/"(url: "/index.html")
*/
"500"(view: '/error')
"404"(view: '/notFound')
}
}
感谢您的更新,这些信息绝对有帮助。但我的情况是,我没有该页面的后备控制器。我正在构建一个应用程序,编译的应用程序只在webapp文件夹中(编译的应用程序有index.html)。所以,如果我编译的应用程序位于文件夹webapp/test /中,那么当我的URL是localhost/test时,我希望它默认呈现index.html,但它没有发生,而是必须输入完整路径localhost/test/index.html - 我希望这能更清楚地说明我的问题。 –
Deewendra Shrestha:你知道了吗?我对AngularJS应用程序有同样的要求。我的index.html位于webapp文件夹中。 – RRK