问题
Difference between ADF initContext and prepareModel,since both preparing data by executing buisness service making it available through binding container which is a Map object.
回答1:
ADF initContext and prepareModel,since both preparing data by executing buisness service
This is not quite correct. The initContext
sets up the BindingContext, which ensures the content of DataBindings.cpx
is initialized and the binding container for the page to be prepared. The prepareModel
is an execution point for data queries.
The other execution point, as Timo's answer shows, is PrepareRender
. Recommendation though is to keep the iterator default setting, which is "deferred" in which case only those iterators are refreshed and queried that have UI dependency.
回答2:
The ADF model life cycle phases:
- initContext sets up the life cycle, working out what PageDefs to load.
- prepareModel creates the bindings object and adds it to the HTTP request. Parameters are also evaluated at this point.
- applyInputValues processes the values posted from the page and builds up an internal list of bindings to update and methods to execute as required.
- validateInputValues applies the client-side validators to the list of updates presented by the applyInputValues phase. These validators are defined as nested f:validator and af:convertNumber components within an input component.
- processUpdateModel sends the validated changes to bound objects to the model layer.
- validateModelUpdates manages validation errors from the Model layer.
- processComponentEvents processes any listeners and action events queued up from the applyInputValues phase.
- metadataCommit manages part of the runtime customization capabilities of the framework.If the user has customized the page in some way such as moving components on the screen or adding in task flows via WebCenter, then those personalizations to the screen are saved away to the metadata repository (MDS) at this point.
- prepareRender is the last phase to execute before the page is displayed.
Note that in some situations (such as a modal dialog), the following code will not necessarily fire after the page has been rendered:
public void afterPhase(PagePhaseEvent pagePhaseEvent) {
if (pagePhaseEvent.getPhaseId() == Lifecycle.PREPARE_RENDER_ID) {
injectRedirect();
}
}
This prevents the server code from being able to examine the af:document immediately after the document is rendered. For example the following will fail because there is no document available:
return context.getViewRoot().getChildren().get(0).getClientId().equals("doc0");
来源:https://stackoverflow.com/questions/11666681/adf-lifecycle-phases-difference