網頁特效phttp://www.111cn.net/網頁特效p.html target=_blank >jsp教程 struts2的初始化和類的建立
<span style="font-weight: normal"> public xmlconfigurationprovider() {
this("xwork.xml", true);
}</span>
<span style="font-weight: normal">public class strutsxmlconfigurationprovider
extends xmlconfigurationprovider {
public strutsxmlconfigurationprovider(boolean errorifmissing)
{
this("struts.xml", errorifmissing, null);
}
…… </span>
//filterdispatch.init():
<span style="font-weight: normal">public void init(filterconfig filterconfig)
throws servletexception {
try {
this.filterconfig = filterconfig;
initlogging();
dispatcher = createdispatcher(filterconfig);
dispatcher.init();////初始化dispatcher.
dispatcher.getcontainer().inject(this);
staticresourceloader.sethostconfig(new filterhostconfig(filterconfig));
} finally {
actioncontext.setcontext(null);
}
} </span>
// dispatch.init():
<span style="font-weight: normal">//這裡是載入設定檔, 真正初始化struts2的action執行個體還沒開始,
public void init() {
if (configurationmanager == null) {
configurationmanager =
new configurationmanager(beanselectionprovider.default_bean_name);
}
init_defaultproperties(); // [1]
init_traditionalxmlconfigurations(); // [2]
init_legacystrutsproperties(); // [3]
init_customconfigurationproviders(); // [5]
init_filterinitparameters() ; // [6]
init_aliasstandardobjects() ; // [7]
container container = init_preloadconfiguration();
container.inject(this);
init_checkconfigurationreloading(container);
init_checkweblogicworkaround(container);
if (!dispatcherlisteners.isempty()) {
for (dispatcherlistener l : dispatcherlisteners) {
l.dispatcherinitialized(this);
}
}
} </span>