【问题标题】:How to redirect one action to another with post request method如何使用发布请求方法将一项操作重定向到另一项操作
【发布时间】:2023-04-06 08:51:01
【问题描述】:

注意:第二个动作只允许 POST 方法。我们不能点击用户的那个动作。

static allowedMethods = [save: "POST",booked:"POST"]

def save()
{
// did save operation here
redirect action:'booked'
}

def booked()
{
//did the operation related with this
render view :'payment'
}

【问题讨论】:

标签: grails


【解决方案1】:

继续尝试

def save()
{// did save operation here
forward action:'booked'
}

def booked()
{
//did the operation related with this
render view :'payment'
}

所有传递给save的参数都会直接传递给booked方法。这是你需要的吗?

【讨论】:

    【解决方案2】:

    您可以通过直接调用保存方法中的方法来执行此操作

    def save(){
    booked()
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多