« ADF Faces: Localizing selectOneChoice labels | Main | ADF Faces: Showing Reports »
ADF: Clearing cached data when working with Web Services in ADF
By frank.nimphius | September 11, 2007
A question on OTN was about building a search form with ADF accessing Web Services. The actual building part of the search form is pretty straight forward, as you would expect from ADF, and involved a web Services method to be dragged and dropped from the data control palette as a parameter form, as well as adding the Web Services result set as a table.
![]() |
The requirement in the post on OTN was to reset the query result so that the next time you navigate to the search page you don't see any cached result from the previous query. To achieve this, the following code deletes all cached data held in the data control
-
FacesContext fctx = FacesContext.getCurrentInstance();
-
-
ValueBinding vb = fctx.getApplication().createValueBinding("#{bindings}");
-
DCBindingContainer dcb = (DCBindingContainer) vb.getValue(fctx);
-
-
DCIteratorBinding dciter = (DCIteratorBinding) dcb.get("itemIterator");
-
DataControl dc = dciter.getDataControl();
-
dc.release(dc.REL_DATA_REFS);
Note however that this not only clears the data shown in the table, but the data available in the iterator, which means that navigating to an edit page after calling dc.release will show an empty form. So make sure this method is called if the data is no longer needed.
Frank
Topics: ADF, Web Service | No Comments »
Comments are closed.

