-
Aug 16th, 2012, 03:15 PM
#1
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
-
Aug 17th, 2012, 09:18 AM
#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" />
</decision-state>
<action-state id="sendEmail">
<evaluate expression="emailService.sendEmail()" />
<transition on="next" to="nextView" />
</action-state>
<view-state id="writeEntryInDbAndDoNothing">
<on-entry>
<evaluate expression="repository.writeSomething()" />
</on-entry>
<transition on="next" to="nextView" />
</view-state>
As you can see, is this example i even mixed view-state with action-state.
Best Regards
Joćo Simas
Software Engineer @ Glintt
-
Aug 21st, 2012, 08:40 AM
#3
thanks for the post.. it was a stupid question but sometimes until you see the question and anwser you are like hmmmm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules