views:

250

answers:

2

I have a view-state that can return multiple events. For most of them, there is a common jave method I want to "evaluate." There are are few where I want to do something different. Each event, however, will transition to a different state. My web flow code now is repeating the evaluate of the method multiple times, once for each applicable transition. Of course, if I wanted to always evaluate the method, I could call it in the on-exit, but since I don't want to do it in all cases, I'm stuck repeating it in the transition calls. Is there any other way to do this?

Frank

A: 

This sounds like a situation where you might consider moving some of the logic that is currently encoded in the flow XML itself into a call to an Action POJO. Perhaps a single call to an Action on on-exit, passing in the flow request context and let the Action method itself figure out (from request parameters) whether your common Java method should be invoked.

Something like this:

<view-state id="home" view="home">
  <transition on="foo" to="fooView" />
  <transition on="bar" to="barView" />
  ...
  <on-exit>
    <evaluate expression="fooAction.invokeIfNecessary(flowRequestContext)" />
  </on-exit>
</view-state>
Scott Bale
A: 

transition to a decision-state evaluate there, and than transition with currentEvent.id to the original target smt like : <decision-state id="decision"> <on-entry> <evaluate ... </on-entry> <if test="currentEvent.id=='goruntule'" then="goruntule"/> <if test="currentEvent.id=='guncelle'" then="guncelle"/> <if test="currentEvent.id=='sil'" then="sil"/> </decision-state>

MCA