您能告诉我为什么以以下简单方式向 Controller 添加新操作时会出现HTTP Status 404资源不可用错误的问题:
当我输入浏览器地址:http://localhost:8080/myApp/user/abc时,它返回不可用的资源。重新启动grails没有帮助。如果输入http://localhost:8080/myApp/user/index,它将按预期工作。
谢谢
最佳答案
我刚刚使用Grails 1.3.7进行了测试。您可以使用redirect(action: "index")
安全地结束 Controller 操作,并且不会引发错误。
我猜你是这样做的:
def index = { [foo: "bar"] }
def abc = { [foo: "bar"] }
在这种情况下,您需要
index
和abc
的专用 View 。如果您改为这样做:
def abc = { redirect(action: "index") }
您将正确重定向。
关于grails - grails错误:请求的资源不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6932045/