Question

I'm working in a java web application with spring (I'm starting with spring webflow). I am analyzing source code made ​​by another developer and I see something like this:

FILE flow.xml :

...
<action-state id="state1">
    <evaluate expression="Utilities.getSomeResult()"></evaluate>
    <transition on="RESULT1" to="doSomething1" />
    <transition on="RESULT2" to="doSomething2" />
</action-state>
...

CLASS Utilities.java :

...
public String getSomeResult() {
  switch(option) {
    case 1:
      return "RESULT1";
    case 2:
      return "RESULT2";
    case 3:
      return "RESULT3";
  }
}
...

What happens if option == 3? some spring exception is thrown? some global transition must be defined to catch it? What is the best approach to solve this issue?

Thank you in advance

Was it helpful?

Solution

Yes, you get an exception in the lines:

   org.springframework.webflow.engine.NoMatchingTransitionException: No transition    was   found on occurence of event "RESULT3" in state "state1".....likely programmer error...

Since its programmer error, it would be ideal to define that missing transition in the respective missing state, say, in your case as: in action-state "state1". Also, global transition would be useful if same transition is shared across all states.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top