Announcement Announcement Module
No announcement yet.
decision-state vs action-state Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • decision-state vs action-state

    I am reading up and dont understand the diff of decision-state vs action-state. I understand that view-state will display a jsp for input but whats the diff of decision-state vs action-state?

    why should I use decision-state over a action-state?
    why should I use a action-state over a decision-state?

    Can someone shot some light on this

  • #2
    Use decision states to evaluate logic to decide wich view or action state should be executed (if else logic)

    Action-state to process. Call a webservice, execute a database call, process a file, etc...

    I'll give you an example:

    <decision-state id="decideIfEmailShouldBeSent">
    <if test="someService.someLogicThatreturnsBoolean()" then="sendEmail" else="writeEntryInDbAndDoNothing" />

    <action-state id="sendEmail">
    <evaluate expression="emailService.sendEmail()" />
    <transition on="next" to="nextView" />

    <view-state id="writeEntryInDbAndDoNothing">
    <evaluate expression="repository.writeSomething()" />
    <transition on="next" to="nextView" />

    As you can see, is this example i even mixed view-state with action-state.

    Best Regards


    • #3
      thanks for the post.. it was a stupid question but sometimes until you see the question and anwser you are like hmmmm