我可以在Grails中使用循环重定向吗?

我正在尝试在Grails中循环重定向(没有无限重定向循环)并继续收到此错误:   org.codehaus.groovy.grails.web.servlet.mvc.exceptions.CannotRedirectException:   无法在此处发出重定向(..)。该   响应已经提交   通过另一个重定向或通过   直接写回应。 我正在尝试做这样的事情,我重定向到控制器上的另一个动作然后重定向回来。想知道为什么Grails不允许这样做。
//initial action and final redirect location
def showStuff = {
        if (flash.neatStuff){
             return render("found neat stuff")
        } else if (params.email) {
            return redirect(action:'getNeatStuff',params:[email:params.email, emailOnly:true])
        }
        return render("Unable to find stuff, use param")
    }

def getNeatStuff = {
        flash.neatStuff = new Date()
        if (params.emailOnly){
              redirect(action:'showStuff')
        }
        redirect(action:'someOtherPlace')
}
    
已邀请:
好吧,我有一个完全的大脑放屁。我更正了下面的代码,以防有人遇到同样的错误。我正在绞尽脑汁看着其他东西,但我只是没有回复动作的重定向。
def getNeatStuff = {
        flash.neatStuff = new Date()
        if (params.emailOnly){
              return redirect(action:'showStuff')
        }
        redirect(action:'someOtherPlace')
}
    

要回复问题请先登录注册