Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Grails:在Webflow末尾将参数从控制器传递到控制器_Grails_Groovy_Grails 2.0 - Fatal编程技术网

Grails:在Webflow末尾将参数从控制器传递到控制器

Grails:在Webflow末尾将参数从控制器传递到控制器,grails,groovy,grails-2.0,Grails,Groovy,Grails 2.0,是否可以在Webflow末尾的重定向中传递“params”?基本上,这个变量或参数从一个控制器传递到另一个控制器的目的是这样的,我想在视图页面上有一个变量或${param.xyz},只有在流程完成时才可用 class Example1Controller{ def startFlow = { begin { .... } .... .... finished {

是否可以在Webflow末尾的重定向中传递“params”?基本上,这个变量或参数从一个控制器传递到另一个控制器的目的是这样的,我想在视图页面上有一个变量或${param.xyz},只有在流程完成时才可用

 class Example1Controller{
    def startFlow = {
        begin {
        ....
        }
        ....
        ....    
        finished {
            action {
                flash.message = 'success'
            }
            redirect(controller: 'example2', action: 'myaccount', params: [author: "Stephen King"])
        } 
     }
  }
其他控制器

 class Example2Controller{
     def myaccount() {
         def here = $params.author
         return [me:here]
     }
 }
普惠制观点

 <html>
     <body>
         <g:if test="${params.me}">
             <p>This is what I want to display: **${me}**</p>
             <p>But it must come from the first controller, from the flow.</p>
         </g:if>
     </body>    
 </html>

这就是我想要显示的:*${me}**

但它必须来自第一个控制器,来自流

基本上,所有这些变量从一个控制器传递到另一个控制器的目的就是这样。我希望只有在流程完成时,视图页面上才有一个变量或${param.}可用

您可以使用



您可以将值从Example1Controller传递到Example1Gsp(作为hideenField),从该GSP您可以在Example2Controller

中获得值如果我没记错的话,我们以前做过,但我们使用了流范围/流变量。比如:

def myFlow = {
    fin {
        redirect: (controller: "xxx", action: "yyy", params: [someValue: flow.someValue])
    }
}
def yyy = {
    [ aaa: params.someValue ]
}
然后,在接收端,类似于:

def myFlow = {
    fin {
        redirect: (controller: "xxx", action: "yyy", params: [someValue: flow.someValue])
    }
}
def yyy = {
    [ aaa: params.someValue ]
}