标签:style blog http io os ar 使用 java for
上篇博客介绍了Struts的架构,接下来将详细的介绍其中的组件,这篇博客要写的是Struts的控制器ActionServlet。<span style="font-family:FangSong_GB2312;font-size:18px;"> ModuleConfig moduleConfig = initModuleConfig("", config);
initModuleMessageResources(moduleConfig);
initModuleDataSources(moduleConfig);
initModulePlugIns(moduleConfig);
moduleConfig.freeze();</span> 第二个代码段来自ModulConfig实现类,是该类的一些变量。表明配置信息根据不同的内容存储在该类对应的HashMap中。<span style="font-family:FangSong_GB2312;font-size:18px;"> this.dataSources = new HashMap();
this.exceptions = new HashMap();
this.formBeans = new HashMap();
this.forwards = new HashMap();
this.messageResources = new HashMap();
this.plugIns = new ArrayList();</span> 这两个的关系就相当于路由和路由表的关系,Struts-config.xml保存的就是转向、调度所需要的映射关系。<span style="font-family:FangSong_GB2312;font-size:18px;"> protected void process(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
ModuleUtils.getInstance().selectModule(request, getServletContext());
ModuleConfig config = getModuleConfig(request);
RequestProcessor processor = getProcessorForModule(config);
if (processor == null) {
processor = getRequestProcessor(config);
}
processor.process(request, response);
}
</span>SSH-Struts(二)—控制器(ActionServlet)
标签:style blog http io os ar 使用 java for
原文地址:http://blog.csdn.net/zhuojiajin/article/details/40518773