我正在运行Grails 1.3.6。我在我的URLMappings.groovy文件中有这个...
static mappings = {
"/$folder?/$page?"{
controller = "Home"
action = "index"
}
"/"(view:"/index")
"500"(view:'/error')
}
这是我的HomeController ...
class HomeController {
def IOService
def index = {
def folder = params.folder;
def page = params.page;
def contents = IOService.getFileContents(folder, page)
response.setContentType("application/json")
response.text = contents
}
}
然而,当我访问我的URL“/ context-path / folder1 / page1”时,我收到Apache Tomcat 404错误(抱怨“/ context-path / folder1”)。我是Grails的新手,但无法弄清楚这一点。如何调整我的映射以使其工作?
谢谢, - 戴夫
答案 0 :(得分:0)
我不确定控制器/操作定义是否不区分大小写。我一直使用小写名称。尝试更改
controller = "Home"
到
controller = 'home'