2 Replies Latest reply on Oct 12, 2006 11:49 AM by Denis Karpov

    one method ending conversation or not

    Leo Baschy Novice

      Let's say I have an action method

      public String submit() {

      and let's say there is logic in it by which normally I am done with the conversation, but in one case I want to stay in the conversation (e.g. go back to a page to fix up information) and traditional validation can't catch it (e.g. because it needs info from more than one object).

      Assume there is important info from the user in a conversation scoped bean. The @End would throw it out, wouldn't it?

      There isn't a way to do this right other than having two separate methonds, one with @End, and the other without.

      public String submit() {
       // still a chance to decide to stay in the conversation
       if (good) {
       return done();
      public String done() {

      That's fine, just making sure I got it right. Call the one with @End only once sure we won't want to stay in the conversation.

      Clearly this is easier if using pageflows, and I think we will.

      Then a question could be whether one method calling the other method in the same bean will cause all the injection to happen over again, or whether it is smart enough to know it is "in the object" already. Or should I just ignore that for now, assume it isn't worth worrying about.

        • 1. Re: one method ending conversation or not
          Pete Muir Master

          Your idea won't work as calls to this.method() aren't intercepted. Look at @End(ifOutcome="").

          • 2. Re: one method ending conversation or not
            Denis Karpov Newbie

            There are two approaches.

            First, if you use Page Flows, then you can make decision node where you decide what is next.

            <page name="yourPage" view-id="/qqq/eee.xhtml">
             <transition name="aaaa" to="check">
             <action expression="#{yourController.doSomething}"/>
            <decision name="check" expression="#{yourController.conditionOfEnd}">
             <transition name="true" to="end">
             <action expression="#{yourController.done}"/>
             <transition name="false" to="yourPage"/>

            Second, you can end your conversation explicitly from the code.