ProgrammingSmurf
asked on
Webflow Partial Rendering - Transition Evaluate not completed before rendering happens
Hi,
I am having an issue with Spring Webflow.
I have a view that contains a standard h:datatable component. In the webflow xml, I define a transition that runs a method to refresh the list dependant on some filter values. The result is assigned to the viewScoped property in the original view. There is then a <render> tag with a fragment of the datatable.
The issue arises in when i hit the transition, i can see the method specified in the evaluate tag being called, and i can see it call the webservice that populates the list given to the datatable. However, the function is still mid way through its call (i halted it on the server hosting the service) - but the page still renders even though the function is still running to re-populate the list.
This gives the impression that the page filter and refresh is always once request cycle behind.
Code Snippets included. Any help is most appreciated.
I am having an issue with Spring Webflow.
I have a view that contains a standard h:datatable component. In the webflow xml, I define a transition that runs a method to refresh the list dependant on some filter values. The result is assigned to the viewScoped property in the original view. There is then a <render> tag with a fragment of the datatable.
The issue arises in when i hit the transition, i can see the method specified in the evaluate tag being called, and i can see it call the webservice that populates the list given to the datatable. However, the function is still mid way through its call (i halted it on the server hosting the service) - but the page still renders even though the function is still running to re-populate the list.
This gives the impression that the page filter and refresh is always once request cycle behind.
Code Snippets included. Any help is most appreciated.
From the flow.xml :
<view-state id="cashBatchListView" view="cashBatchList.xhtml" model="webapp">
<on-entry>
<evaluate expression="inwardCashService.retrieveBatchesForFilter(webapp, messageContext)" result="viewScope.batchHeaders" result-type="dataModel" />
</on-entry>
<transition on="applyFilter">
<evaluate expression="inwardCashService.retrieveBatchesForFilter(webapp, messageContext)" result="viewScope.batchHeaders" result-type="dataModel" />
<render fragments="cashBatchDataTableForm:batchListTable"/>
</transition>
</view-state>
From the facelet....
<h:dataTable id="batchListTable" styleClass="summary"
value="#{batchHeaders}" var="bh"
rendered="#{batchHeaders.rowCount > 0}">
From the backing bean ...
public List<BatchHeader> retrieveBatchesForFilter(InwardCashWebParamService webParam, MessageContext messageContext) {
ArrayList<BatchHeader> bhArray = new ArrayList<BatchHeader>();
try {
Getrecordstodisplayintype input2 = new Getrecordstodisplayintype();
// Set params omitted from snippet
System.out.println("Doing WebService ... ");
Record[] bhs = icp.getrecordstodisplay(input2);
System.out.println("returned from WebService ... ");
for (int x=0;x<bhs.length;x++)
{
BatchHeader bh = new BatchHeader();
// set up a item for list omitted from Snippet
bhArray.add(bh);
}
} catch (Throwable error) {
System.out.println("Throwing Error:" + error.getMessage());
throw new RuntimeException(error);
}
List<BatchHeader> bhList = bhArray;
return bhList;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I do not hit a throwable error, i can see the service complete normally ... but by this time, the web page is already rendered.