All right, all right. It won't be long before I take part in the social recruit, every day in the blog update five Java aspects of the questions and reference answers.
Recently came the frame section first.
The first is struts2;
Begin!
1.STRUTS2 working mechanism?
For:
1. The client initializes a request to the servlet container (for example, Tomcat);
2. This request passes through a series of filters (filter) with an optional filter called Actioncontextcleanup, which is useful for integration of Struts2 and other frameworks, such as Sitemesh Plugin);
3, then Filterdispatcher is called, Filterdispatcher asked Actionmapper to decide whether the request needs to invoke an action;
4, if Actionmapper decided to call a action,filterdispatcher to the processing of the request to actionproxy;
5, Actionproxy through the configuration Manager to ask the framework profile, find the action class that needs to be called;
6. Actionproxy create an instance of Actioninvocation.
7. The Actioninvocation instance is invoked using a naming pattern, which involves a call to the relevant interceptor (Intercepter) before and after the action is invoked.
8. Once the action is executed, Actioninvocation is responsible for finding the corresponding return result according to the configuration in the Struts.xml. The return result is usually (but not always, possibly another action chain) a JSP or freemarker template that needs to be represented. The tags inherited in the STRUTS2 framework can be used in the representation process. In this process, it is necessary to involve actionmapper.
2. What are the benefits of using struts? Why use struts?
For:
1. It is based on the well-recognized pattern of MVC, struts on M, V and C are involved, but it is mainly to provide a good controller and a set of custom tag library, that is, its focus on C and V, so it is born with MVC brings a series of advantages, such as: structured hierarchy, High reusability, increase the robustness and scalability of the program, facilitate the development and design division of labor, provide centralized and unified access control, calibration, internationalization, logging and so on;
2. Second, it is an open source project has been included its inventor Craig R.mcclanahan, including some of the program Masters and master continued and careful care, and withstood the actual test, so that its function more and more powerful, the system is also improving;
3. It is a good integration of other technologies and frameworks.
Struts-based applications consist of 3 types of components: Controller components, model components, view components
How is the 3.Struts Validate framework validated?
For:
Configure specific error prompts in the struts configuration file, and then invoke the Validate () method in Formbean.
Detailed verification and explanation: http://perfectplan.iteye.com/blog/1561805
4. The design pattern of struts
For:
MVC pattern (Model-view-controller Model-View-Controller)
Struts mainly acts as a controller
5.Action implementation of the integration of common that way?
For:
One is to implement your action directly, and the other is to implement the interface inheritance of action Actionsupport
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Five Java-related face questions per day (1)--struts2 part