1

I have two controllers and each one have a flow. In my menu I have a link to the flows. If I'm in flow #1 and click in the link of the flow #2, Grails will show me the view of the flow #1.

The only way I found to make this transition work was to have a link to an action that redirects to the flow.

class FirstController {
  def firstFlow = {
  }

  def toFirst() {
    redirect action: 'first'
  }

}

class SecondController {
  def secondFlow = {
  }
  def toSecond() {
    redirect action: 'second'
  }
}
  • Going to /first/first shows the view correctly.
  • Going to /second/second shows the view of first.
  • Going to /second/toSecond redirects and show the view correctly.
  • Backing to /first/first shows the view of second
  • Goingo to /first/toFisrt shows the view correctly.

Is this a expected behavior? Why the flow don't go to the correct view?

EDIT

The menu is created using Platform Core Navigation API.

navigation = {
  app {
    first(controller: 'first', action: 'first', title: 'nav.exportar')
    second(controller: 'second', action: 'second', title: 'nav.importar')
  }
}

Links

http://localhost:8080/my-application/first/first?execution=e14s1
http://localhost:8080/my-application/second/second?execution=e14s1
  • how does your link to the other flow look like or how do you create it ? – john Smith Apr 22 '13 at 19:07
  • @johnSmith I edited the question with the menu info. –  Apr 22 '13 at 19:15
  • I might be mistaken here, but the execution url(e14s1) is the same for both, shouldn't be different if you are having 2 different flows? maybe thats why its overstepping the other flow – Alidad Apr 25 '13 at 03:16
  • What code do you have in each flow of both controllers? – dmahapatro Aug 08 '13 at 03:49
  • @dmahapatro Bounty hunter? :-) See the controllers in the question. I think you can simulate the issue using them. The original controllers have too much code to show here. –  Aug 08 '13 at 12:30

1 Answers1

0

If we want to cease a flow process (like clicking menu), we need to tell webflow end-state.

so the menu link url should include eventId parameter that means end-state.

I don't know navigation api, but g:link example below:

<g:if test="${params.action=='first'}"><%-- we are in first flow. --%>
    <g:link event="toSecond">Go to second</g:link>
</g:if>
<g:else><%-- we are not in first flow, normal link. --%>
    <g:link controller="second" action="second">Go to second</g:link>
</g:else>

and first controller:

class FirstController {
    def firstFlow = {
        // view-state
        firstViewState {
            on('next').to 'nextAction'
            on('toSecond').to 'toSecond' // <g:link event='toSecond'> in gsp
        }

        // end-state
        toSecond() {
            redirect (controller:'second', action:'second')
        }
    }

    def toFirst() {
        redirect action: 'first'
    }
}
Saghir A. Khatri
  • 3,429
  • 6
  • 45
  • 76