Struts 1.2 Controller principle (transfer)

Struts1.2 application is still very broad framework, familiar with the basic control process is necessary:

1, ActionServlet initialization

Struts ActionServlet as a component of the front controller, because the corresponding web.xml configuration:

<load-on-startup> 0 </ load-on-startup>

In the application of a load that will be instantiated and call its init method, init method of the work, there are two:

Loaded struts configuration file, and create a package configuration information for the object loaded ModuleConfig resource file, and create resource files for the package MessageResources object needs to pay attention to two things:

If the web.xml multiple module configuration, will create multiple ModuleConfig objects and MessageResources objects were used to encapsulate various modules of the struts configuration file and resource files.
Created for each module and MessageResources ModuleConfig object will be stored in the ServletContext object, the corresponding attribute name in the name of the module corresponding logo.
Also, if the corresponding configuration, then, init method will initialize the data source and PlugIn

<wbr> </ wbr> <wbr> </ wbr>

Second, ActionServlet the process

All of the form *. do requests (in accordance with the relevant web.xml configuration) will be submitted to the ActionServlet, will eventually call its process method. process there are three main methods:

Informed of the requested information, upon request, the module name obtained from the ServletContext and requests the ModuleConfig corresponding object module, and stored in the request.
According to information obtained corresponding module RequestProcessor object, a module corresponds to a RequestProcessor object, RequestProcessor object associated with their corresponding ModuleConfig object module.
Call the process method of RequestProcessor object will request and response as a parameter to it.
3, RequestProcessor's process

RequestProcessor object method of the main work process five steps:

Call your processPreprocess (request, response) method, which does not carry out any operation, for the subclass override to expand its capabilities.
Be matched with the request address ActionMapping object, AcionMapping object used to encapsulate a particular acion configuration information.
According to the configuration information obtained ActionMapping ActionForm object (the object will be cached in the request or session), and fill the form data to the ActionForm, and then decide whether under the ActionMapping configuration verification ActionForm, if verified, will call the validate method of ActionForm If the returned object contains ActionMessage object ActionErros said validation fails, will turn to action directed by the configuration information input property addresses.
If no authentication or verification by ActionForm will create and cache the requested address matches the Action object, the object ActionMapping, ActionForm object, request and response as a parameter called the execute method.
According to Action's execute method returns an object of the ActionForward object, or redirect the request to forward the package to the address of the ActionForward.

分类:Java 时间:2010-08-17 人气:149
分享到:
blog comments powered by Disqus

相关文章

  • Data Source Xiangjie 2010-04-15

    First, the data source Description: ************************************************** ********************************** In the Java language, DataSource object is a representative of the data source entity objects. A data source is a tool used to s

  • [Lucene3.0 the first glimpse of] Document / Field data source structure 2010-04-07

    In the retrieval of data, we very much hope that can retrieve various information out of data sources. Search on such a disk file, you can retrieve the file path, name, content, modified, etc.. Another example search Books ISBN, title, author, public

  • Detailed data source (reproduced) 2011-09-08

    Original link: http://club.topsage.com/forum.php?mod=viewthread&tid=2549653 First, the data source Description: In the java language, datasource object is a data source on behalf of the entity object. A data source is a tool used to store data, it ca

  • [Lucene3.0 Quest] Document-Field data source representation 2010-04-07

    In the retrieval of data, we very much hope that can retrieve various information out of data sources. Search on such a disk file, you can retrieve the file path, name, content, modified, etc.. Another example search Books ISBN, title, author, public

  • Create a new JNDI Data Source in Websphere 6.1 2010-08-13

    First of all, the point of Websphere bad! Do not look at it as multi-functional, basically all the functions can be configured in the admin console, but it is tasteless. Many configurable functions and not flew into force, flying restart Websphere to

  • Get a database connection (in the normal way and the way the data source) 2010-12-15

    Step One: Create a JavaWeb works, called DBConnPrjTest (this project name is variable) Step Two: In DBConnPrjTest \ WebRoot \ WEB-INF \ lib, add the following package and loaded into the project: commons-logging-1.1.1.jar ojdbc14.jar: oracle database

  • The solution: "set in the Flex DataGrid's data source, suggesting that null" 2010-12-19

    The solution: "set in the Flex DataGrid's data source, suggesting that null" Operating Environment: MyEclipse8.5GA, Flex Builder4 plugin. BlazeDS, MySQL, tomcat6 First configuration: Spring Hibernate blazeDS In the remoting-config.xml, the confi

  • What is the ODBC data source 2011-04-13

    What is the ODBC data source, Control Panel management doing the odbc data source with the Popular talk: odbc connection is a database that contains database connection information, a data source, the control panel is the odbc data source odbc data s

  • Tomcat.Apache. Servlet.xml. JNDI (data source) 2010-10-12

    Transfer from: http://www.newasp.net/tech/java/14525.html 1, the installation TOMCAT latest version is 5.0.29 (http://jakarta.apache.org/site/binindex.cgi) WINDOWS if it can automatically find you under the JDK or set JAVA_HOME = c: / jdk Under the L

  • Data Source Configuration Xiangjie Tomcat 6 2010-07-21

    With TOMCAT6 has for some time, before connecting to the database are using traditional methods. Because the data source to connect the database with better performance, all must know how to configure the data source. The following is configured MYSQ

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.190 (s). 12 q(s)