Announcement Announcement Module
Collapse
No announcement yet.
Multiple expressions inside one transition Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple expressions inside one transition

    Hello everyone,
    Imagine we've got a simple class:

    Code:
    public class SimpleClass {
        public void voidMethod() {
            System.out.println("inside void method");
        }
    
        public String stringMethod() {
            System.out.println("inside string method");
            return "hello";
        }
    
        public Object objectMethod() {
            System.out.println("inside object method");
            return new Object();
        }
    }
    We also have the following transition in some flow's xml:
    Code:
            ...
            <var name="simpleClass" class="com.mycompany.SimpleClass"/>
            ...
    	 <transition on="someEvent" to="someView">
                <evaluate expression="simpleClass.voidMethod()"/>
                <evaluate expression="simpleClass.stringMethod()"/>
                <evaluate expression="simpleClass.objectMethod()"/>
            </transition>
            ...
    The following thing looks odd for me: after execution of 'stringMethod' the execution sequence breaks (that is, 'objectMethod' never gets called). No errors in the log. However, if I swap 'stringMethod' with 'objectMethod' all 3 methods are called:
    Code:
            ...
    	 <transition on="someEvent" to="someView">
                <evaluate expression="simpleClass.voidMethod()"/>
                <evaluate expression="simpleClass.objectMethod()"/>
                <evaluate expression="simpleClass.stringMethod()"/>
             </transition>
            ...
    I had searched in webflow reference guide but didn't find anything about the behaviour like that. Does anyone has any concerns?

    Thanks in advance!

  • #2
    When evaluating a expression inside a transition, if the expression result is a String, it will be considered successful if it is "success", "true" or "yes". Otherwise, it will be considered a failure and will stop the execution of the transition (and all the remaining evaluations).

    Comment


    • #3
      So if I need a string as the output for my expression method I will have to wrap it in some object. This makes sense, thanks triqui

      Comment

      Working...
      X