【发布时间】:2013-01-28 10:34:44
【问题描述】:
是否可以在 Webflow 结束时在重定向中传递“参数”?基本上,这个变量或参数从控制器传递到控制器的目的是,如果流程已经完成,我希望在视图页面上仅有一个变量或 ${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>
基本上所有这些变量从控制器传递到控制器的目的是这样的。我希望只有在流程完成后才能在视图页面上使用变量或 ${param.}。
【问题讨论】:
标签: grails groovy grails-2.0