PDA

View Full Version : Partial view rendering after an action-state or decision-state?



dgashby
May 29th, 2010, 04:35 PM
Hi,

I've been trying to get the following scenario working without much success.

From view-state 'test' on transition 'actionTest' I want to perform some checks which will determine whether we stay on view-state 'test' and simply refresh the result fragment or move on to the 'test_end' view-state.

Here's the flow setup I'm using:




<view-state id="test" >
<transition on="actionTest" to="test_decide"/>
</view-state>

<action-state id="test_decide" >
<evaluate expression="testFlowHandler.decide()" />
<transition on="refresh">
<render fragments="testForm:resultFragment"/>
</transition>
<transition on="finished" to="test_end"/>
</action-state>

<view-state id="test_end" />



Here's the view for the 'test' view-state:




<h:form id="testForm">

<h:panelGroup id="resultPanel">
<ui:fragment id="resultFragment">
<p>Result: <h:outputText id="result" value=" #{testFlowHandler.result}"/></p>
</ui:fragment>
</h:panelGroup>

<sf:commandLink id="linkTest" action="actionTest" value="Test" />

</h:form>



The testFlowHandler.decide() method is hardwired to return 'refresh' at the moment and with webflow debug turned on I can see that webflow is executing the render action and updating attributes to include the testForm:resultFragment. However the view does not refresh.

Using Firebug to trace the network flow, upon triggering the actionTest transition, I see a POST request return with a 200 response, but with no response body or spring-redirect-url in the response header. This explains why I'm not seeing the view refresh, but it doesn't solve my problem.

Am I trying to do something that's not possible? Or am I missing some other piece of puzzle?

Thanks,

Dean

InverseFalcon
Jun 1st, 2010, 02:48 PM
Your transition in your action state doesn't go anywhere. I don't think that's going to work. You'll either need to transition back to your view-state, which may cause a full-page refresh, or you'll want to move this check into your transition from your view-state. For example:



<view-state id="test" >
<transition on="actionTest" to="test_end">
<render fragments="testForm:resultFragment"/>
<evaluate expression="testFlowHandler.decide() == 'finished'"/>
</transition>
</view-state>

<view-state id="test_end" />


Placing the render action first guarantees it will refresh even if the transition is cancelled.

If the evaluate fails, the transition will be cancelled and you will remain on your current page.