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.
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Struts 1.2 Controller principle (transfer)

  • hibernate using c3p0 connection pooling

    Private http://www.lifevv.com/tenyo/doc/20070605102040991.html c3p0 for open source's JDBC connection pool, with the release hibernate. This article describes how to use the hibernate configuration in c3p0. c3p0 connection pool configuration is v ...

  • Hibernate configuration parameters hibernate.hbm2ddl.auto

    Hibernate in the configuration file: <properties> <property name="hibernate.hbm2ddl.auto" value="create" /> </ properties> Parameter Description: validate load hibernate, the authentication to create a database t ...

  • Build flex + spring + blazeds + hibernate application

    Build flex + spring + blazeds + hibernate application First, set up the project blazeds 1, will blazeds.war extract to a directory, such as: myflex /; 2, set up java works were such as: MyFlex, in the orientation of selection create project from exis ...

  • Hibernate connection pool configuration

    Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.132:15

  • The EJB3 Persistence

    EJB3 persistence with Hibernate is very similar to the mechanism: Environment: Server: JBOSS5.0 Database: MySQL5.0 1. Set up a data source First of all, in jboss-5.0.0.GA \ server \ default \ deploy, the establishment of a database used to connect the dat

  • hibernate to use the principle of

    The use of hibernate, implementation of data persistence. Has the following several processes. One configuration database connection information. Hibernate.config 2 configuration mapping. 3 use: the use of the process are the following steps: 3.1: Ge ...

  • hibernate generic generic DAO

    package org.lzpeng.dao; import java.io.Serializable; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.criterion.Criterion; import org.springside.modules.orm.hibernate.Page; /** * * @version 2009-1-10 *

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

  • Hibernate secondary cache

    Hibernate cache: 2-bit cache, also known as process-level cache or SessionFactory level cache, secondary cache can be shared by all of the session Cache configuration and the use of: Will echcache.xml (the document code in hibernate package directory ...

  • Hibernate's lazy strategy

    hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries