ActionServlet's init()

本文详细介绍了Struts框架的初始化过程。包括初始化框架内部消息包、从web.xml文件加载控制ActionServlet类行为的初始化参数、加载并初始化Servlet名称和映射信息、加载并初始化默认应用的Struts配置数据等多个步骤,确保框架正常运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

figs/jstr2_0502.gif

1、Initialize the framework's internal message bundle. These messages are used to output informational, warning, and error messages to the log files. The org.apache.struts.action.ActionResources bundle is used to obtain the internal messages.

2、Load from the web.xml file the initialization parameters that control various behaviors of the ActionServlet class. These parameters include config, debug, detail, and convertNull.

3、Load and initialize the servlet name and servlet mapping information from the web.xml file. These values will be used throughout the framework (mostly by tag libraries) to output correct URL destinations when submitting HTML forms. During this initialization, the DTDs used by the framework also are registered. The DTDs are used to validate the configuration file in the next step.

4、Load and initialize the Struts configuration data for the default application, which is specified by the config initialization parameter. The default Struts configuration file is parsed and an ApplicationConfig object is created and stored in the ServletContext. The ApplicationConfig object for the default application is stored in the ServletContext with a key value of org.apache.struts.action.APPLICATION.

5、Each message resource that is specified in the Struts configuration file for the default application is loaded, initialized, and stored in the ServletContext at the appropriate location, based on the key attribute specified in each message-resources element. If no key is specified, the message resource is stored at the key value org.apache.struts.action.MESSAGE. Only one message resource can be stored as the default because the keys have to be unique.

6、Each data source declared in the Struts configuration file is loaded and initialized. If no data-sources elements are specified, this step is skipped.

7、Load and initialize each plug-in specified in the Struts configuration file. The init() method will be called on each and every plug-in specified.

8、Once the default application has been properly initialized, the servlet init() method will determine if any application modules are specified and, if so, will repeat Steps 4 through 7 for each one.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值