網頁特效p/網頁特效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>
1 2