Struts2 framework brief

To understand the Struts2 details, please click Portal

working principle

Struts2 frame processing roughly divided into the following steps:

  1. The client initiates a pointing servlet container (such as Tomcat) request.

  2. This request through a series of filters (the Filter) (these filters have called the ActionContextCleanUp optional filter, this filter frame for Struts2 inheritance and other useful, for example: SiteMesh Plugin).

  3. Then FilterDispatcher is called, FilterDispatcher ActionMapper asked to decide whether the request to call an Action.

  4. If you decide to call a ActionMapper Action, FilterDispatcher the processing of the request to ActionProxy.

  5.ActionProxy asking the profile of the frame by Configuration Manager, find the need to call the Action class.

  6.ActionProxy create an instance of ActionInvocation.

  7.ActionInvocation instance naming scheme that call, before or after the Action procedure call, calls involving related interceptor (interceptors are) a.

  Action 8. Once finished, ActionInvocation responsible for finding the corresponding return results based struts.xml configuration. The results returned are usually (but not always, it could be another Action chain) or a template jsp freemaker is represented required. You can use Struts2 framework inherited labels in the course of representation. In this process, the need to involve ActionMapper.

work process

  1. Enter the url address of the client browser.

  2. The request to the tomcat url via http protocol.

  3.tomcat found inside the web.xml corresponding item according to url.

  4. In the web.xml will find struts2 configuration

  5. Then find struts2 struts.xml corresponding configuration file.

  The url parsing configuration files struts.xml will find the corresponding class.

  7. End call returns a word class String, return to the corresponding jsp according struts.xml.

  

Guess you like

Origin www.cnblogs.com/tizer/p/11391015.html