开发者

Grails Web Flow first state

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.


You also can to use the onStart event

def csikszentmihalyiFlow = {
    onStart doSomethingClosure
....
}

doSomethingClosure = {
    def doSome = new Thing()
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜