Grails Web Flow的第一个状态 [英] Grails Web Flow first state

查看:120
本文介绍了Grails Web Flow的第一个状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于Grails Web流程的第一种状态的几个问题:


  1. 是否可以有多个启动状态?
  2. >
  3. 第一个状态有可能是一个动作状态吗?

  4. 假设(2)的答案是否定的,我有什么选择将数据传递给第一个(视图)状态?我可以事先将它存储在会话中,但这不是很有吸引力,因为我需要自己去处理它。理想情况下,我希望在显示第一个(视图)状态之前将数据存储在流程范围中,但我不明白这是如何实现的。



  def createNewSubscriptionFlow = {
initialState {
action {
...

然后在您声明时抓取您需要的数据并将其存储在流程范围中(需要可序列化!)。 / p>

在回答1时,我不认为您可以拥有多个启动状态,但您可以让您的初始操作状态决定要转移到的状态。



谢谢,


A few questions about the first state of a Grails web flow:

  1. Is it possible to have multiple start states?
  2. Is it possible for the first state to be an action state?
  3. Assuming the answer to (2) is no, what are my options for passing data to the first (view) state? I could store it in the session beforehand, but this isn't very appealing because I would need to take care of removing it myself. Ideally I'd like to store the data in flow scope before the first (view) state is displayed, but I don't see how this is possible

解决方案

You can have an action state as the first state in a webflow and you can pass parameters in to it as any other controller action and get them with 'params.paramName'.

def createNewSubscriptionFlow= {
    initialState {
        action {
           ...

Then grab the data you need and store in flow scope(Needs to be serializable!) as you state.

In answer to 1, I don't think you can have multiple start states but you could make your initial action state decide what state to move to.

Thanks,

Jim.

这篇关于Grails Web Flow的第一个状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆