Announcement Announcement Module
Collapse
No announcement yet.
Webflow Expression blowing up Transition Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Webflow Expression blowing up Transition

    Weird issue. I have something like this:

    Code:
    <action-state id="myactionstate">
        <evaluate expression="flowScope.findSomeValue"/>
        <transition on="somevalue" to="someView">
            <evaluate expresssion="myHandler.myMethod(hello)"/>
            <evaluate expression="myHandler.figureItOut(flowRequestContext)" result="flowScope.myBoolean"/>
        </transition>
         ....
    </action-state>
    I'm using WebFlow 2.0.3. When I have that second evaluation node in my transition node I get a:

    Code:
    java.lang.IllegalStateException: You can only resume paused view states, and state [myactionstate] is not a view state - programmer error
    When I remove the evaluation it works.....

    I thought two evaluations were OK? I tried removing the result attribute from it, I've tried making it the first evaluate expression in the transition node. Only when I take it out does the flow work.

    The evaluate expression returns a boolean type (NOT Boolean) as a result.

    Any insight, anyone?

  • #2
    I thought two evaluations were OK?
    Yes

    I tried removing the result attribute from it
    Not good

    java.lang.IllegalStateException:
    You can only resume paused view states,
    and state [myactionstate] is not a view state - programmer error
    The error is clear, you have an <evaluate expression> within an
    <action-state> and not in a <view-state> like it is requested

    What are you doing in the Java code? (myHandler.figureItOut)

    Comment


    • #3
      I disagree. You shouldn't have any trouble using evaluate actions within action states.

      However, I suspect dr. pompeii is right that there's something going on in your myHandler.figureItOut() method. Sounds like you're trying to resume a view state from within there?

      I suspect if you leave figureItOut in, but take away your myHandler.myMethod() action, you're still going to see the same error.

      In summary, this isn't a problem with multiple actions. That's fine. I think the problem is what you're trying to do within that method call.


      EDIT:

      Hmm...There is a chance I could be wrong. Try changing your evaluate action into a set action, like so:

      Code:
      <set value="myHandler.figureItOut(flowRequestContext)" name="flowScope.myBoolean"/>
      See if that still throws the exception.
      Last edited by InverseFalcon; Nov 5th, 2010, 12:45 AM.

      Comment


      • #4
        Gentlemen thank you for your responses and time!

        I changed the evaluate to what InverseFalcon recommended <set> and that worked!

        InverseFalcon I would be extremely grateful if you would take some more time to explain how you thought that might be feasible besides it being the only other option of setting the value in the flowScope ;-). I'm really curious what fundamental Webflow concept I am missing!

        To answer the question as to what my java method is doing I need to clarify that I am passing in the RequestContext and a custom POJO which contains a list of items. I iterate over the list of items, if a certain item is in the list I return true, otherwise false. That's it.

        Code:
        public boolean myMethod(RequestContext flowRequestContext, MyObject object) {
            boolean myBoolean = false;
            if(object.getList() != null) {
                for(...) {
                  ....
                  if(....){
                    myBoolean = true;
                  }
                }
            }
        
            return myBoolean;
        }

        Comment


        • #5
          Well, Dr. Pompeii was half-right. While there's no problem using an evaluate action in an action-state, there's a danger about using an evaluate action inside a TRANSITION element inside an action-state.

          Here's why:
          Within a transition, the outcome of evaluate actions can affect the execution of the transition. If the result is false, no, failure (not sure on this one), then the transition is cancelled. Within view-states, this usually resumes the current view-state. In action-states? This isn't defined, I don't think.

          Set action outcomes aren't evaluated, and as far as I know can't cancel a transition. I tend to favor set actions when I'm setting anything, and only using evaluate actions if there's no return value, or if I need to potentially cancel a transition based on the outcome.

          Comment


          • #6
            Originally posted by InverseFalcon View Post
            Well, Dr. Pompeii was half-right. While there's no problem using an evaluate action in an action-state, there's a danger about using an evaluate action inside a TRANSITION element inside an action-state.

            Here's why:
            Within a transition, the outcome of evaluate actions can affect the execution of the transition. If the result is false, no, failure (not sure on this one), then the transition is cancelled. Within view-states, this usually resumes the current view-state. In action-states? This isn't defined, I don't think.

            Set action outcomes aren't evaluated, and as far as I know can't cancel a transition. I tend to favor set actions when I'm setting anything, and only using evaluate actions if there's no return value, or if I need to potentially cancel a transition based on the outcome.
            Thanks for the explanation! The error message actually makes more sense to me now.

            Comment


            • #7
              I disagree. You shouldn't have any trouble using evaluate actions within action states.
              I never said that is wrong, I only did an explicit reference to the error stack trace

              While there's no problem using an evaluate action in an action-state, there's a danger about using an evaluate action inside a TRANSITION element inside an action-state.
              SWF 2.X.x work in other way, but I used to work in this way in SWF 1.5.x about returning an Event

              Code:
              public Event doSomethingTwo(RequestContext context) throws Exception{
              ....
              catch(MyFinderException mfe){
                  context.getFlowScope().put("MiErrorMessage", ".....");
                  return error();
              }
              return success();
              I suggest you read a little more about SWF 2.x.x documentation

              Comment

              Working...
              X