gpt4 book ai didi

grails - Grails:具有.gsp扩展名/格式的URL映射

转载 作者:行者123 更新时间:2023-12-02 15:40:50 25 4
gpt4 key购买 nike

我有一个像www.xyz.com/customer/list.gsp这样的网址请求

当我尝试映射网址以删除.gsp时:

"/customer/list.gsp"(controller: "customer") {
action = "list"
}

grails应用程序无法识别网址,并抛出404错误。我在这里想念什么吗?

最佳答案

如果要从网址中删除.gsp,则可以使用这样的映射...

"/customer/list"(controller: "customer") {
action = "list"
}

您也可以这样做...
"/customer/list"(controller: "customer", action: "list")

如果要为 Controller 中的所有 Action 映射1,则可以执行以下操作:
"/customer/$action"(controller: "customer")

默认生成的映射包括 "/$controller/$action",它允许您映射到任何 Controller 中的任何 Action 。

有了这些,发送请求到 /customer/list就可以了。

关于grails - Grails:具有.gsp扩展名/格式的URL映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61395141/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com