CygnusKnight
CygnusKnight

Reputation: 87

Back to previous view-sate after action state

I'm using Spring webflow for my product. In current view-state I have a transition to a action-state to decide which states to go next. However, there's a case requiring to stay at current view-state after action-state. I treated it the same as other states but it caused a reload of my current page. I don't want that. Is there any other way to do this ?

Upvotes: 1

Views: 2230

Answers (1)

klr8
klr8

Reputation: 665

The fact that your page reloads is normal because webflow sees this as an exit of the view-state when transitioning to the action state and a re-entry of the same view-state when leaving the action-state again. So to avoid the reload you have to avoid leaving the view-state in the first place. There are several way to do this. The simplest way I can think of is to use an EL expression to select the target state directly from the transition element, instead of putting that logic in a separate action-state:

<view-state id="bla">
    <transition on="submit" to="#{someAction.selectNextStateId()}" />
</view-state>

Upvotes: 1

Related Questions