I am facing this weird issue in 12C JDEV:
I have such definitions in adfc-config.xml:
<view id="mystring">
<page>page_a.jspx</page>
<view-id>page_a.jspx</view-id>
<redirect/>
</view>
<control-flow-case>
<from-outcome>mystring</from-outcome>
<to-activity-id>mystring</to-activity-id>
</control-flow-case>
and the page associated to this "mystring" is page_a.jspx.
When clicking on 2 menus which actions both lead to the above "mystring", hence page_a.jspx, the second menu seems not responding at all. When debugging, it shows that in the controller class associated to the page_a.jspx, the second visit is considered as a "postBack" since "isPostBack()" in onPagePreRender() returns true. This appears to be the reason that the second time, page_a.jspx is not reloaded at all(if reloaded, some texts will be updated for the second time). To verify that,I simply refreshed the same page_a.jspx after second click, and the page_a.jspx got updated with texts expected.
So my question, is this a expected behavior or not by design of ADF? Either way, is there a workaround to get the second visit to reload the page?
Thanks, Shawn
Just find an answer myself: in the controller class' onPagePreRender() method, refresh the whole page_a.jspx (sample codes taken from this url: http://adfblogspot.blogspot.ca/2012/06/how-to-reload-whole-jsfjspx-page-from.html):
public String refreshPage_action() {
FacesContext fctx = FacesContext.getCurrentInstance();
String pageToRefresh = fctx.getViewRoot().getViewId(); //getting View Id of current page
ViewHandler viewHandler = fctx.getApplication().getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(fctx, pageToRefresh); //ViewRoot for current page
viewRoot.setViewId(pageToRefresh);
fctx.setViewRoot(viewRoot); //set the viewroot in facesContext to reload
return null;
}
controller class:
public void onPagePreRender() {
super.onPagePreRender();
// do you data update then call refreshPage_action()
}
this force the page reloaded everytime.