【发布时间】:2012-03-01 18:57:10
【问题描述】:
这是我认为我想做的事情:
class MyController {
def goToWizard = {
if (params.option1)
redirect actionName:'wizard1', params:params
if (params.option2)
redirect actionName:'wizard2', params:params
}
def wizard1Flow = {
start {
action {
// put some values from the params into flow scope
[thingsThatGotPassedIn:params.thingsThatGotPassedIn]
}
on('success').to 'nextThing...'
}
// wizard 1 implementation...
//...
done {
redirect view:'somewhereElse'
}
}
def wizard2Flow = {
start {
action {
// put some values from the params into flow scope
[thingsThatGotPassedIn:params.thingsThatGotPassedIn]
}
on('success').to 'nextThing...'
}
// wizard 2 implementation...
//...
done {
redirect view:'somewhereElse'
}
}
}
我已经尝试过这样的事情,但我似乎从来没有进入过网络流。这是一种有效的方法吗?
这一切的原因是我有一个看起来像这样的 gsp(一个内部有 2 个提交按钮的表单,每个应该触发不同的 webflow)
<g:form action="goToWizard">
...
<g:submitButton name="wiz1" value="Goto Wizard1"/>
<g:submitButton name="wiz2" value="Goto Wizard2"/>
</g:form>
表单中有一些输入元素,我想将它们的值传递到调用的任何 webflow 中。我宁愿让表单提交直接调用适当的webflow(我见过的所有示例都工作的方式),但是有两个webflow,只有一个表单。我怎样才能做到这一点?
如果您认为这是错误的方法,我也对替代实现感兴趣。我是 grails 中的 webflows 新手。
【问题讨论】:
标签: grails redirect spring-webflow