一.通过jsp来触发一个action,然后会先执行一个过滤器Filter( StrutsPrepareAndExecuteFilter核心过滤器/核心控制器 )
↓↓↓↓↓(创建调度器加载配置信息)
↓↓↓↓↓(初始化加载配置文件顺序)
配置文件的加载顺序:
创建了StrutsPrepareAndExecuteFilter的时候,在init方法中执行Dispatcher中的init方法:
init_DefaultProperties(); // [1] ----加载org/apache/struts2/default:default.properties(常量配置文件)
init_TraditionalXmlConfigurations(); // [2] ----加载struts-default.xml,struts-plugin.xml,struts.xml
init_LegacyStrutsProperties(); // [3] ----加载自定义struts.properties(可能有也可能没有)
init_CustomConfigurationProviders(); // [5] ----加载用户配置提供
init_FilterInitParameters() ; // [6] ----加载web.xml
init_AliasStandardObjects() ; // [7] ----加载Bean
因为这个三个配置文件都可以修改struts2中常量:后加载的修改的常量会生效!!!
[1]加载default.properties
[2]加载XML配置文件