Introduction to struts 2_ Power node Java college sorting

This paper explains the introduction knowledge of struts 2 framework for your reference. The specific contents are as follows

1. Introduction to struts 2 Framework

Struts 2 framework is an MVC process framework, which is suitable for layered development. The framework application implementation does not rely on servlets and uses a large number of interceptors to process user requests, which is a non intrusive design.

2. Process principle of struts 2 Framework

1) The request first reaches the filter central controller 2) then creates a proxy class for the action 3) stores each service in the interceptor, executes the action class after executing the interceptor, calls the service, and then calls Dao 4) gets the result string, creates the result object 5) turns to the corresponding view.

The procedure flow chart is as follows:

3. Use of framework

The framework is well encapsulated for us. When we use it, we just follow the steps and configure several XML files.

1) Import jar package

2) Copy struts XML file

Put the copied configuration file in the root directory Src. struts. The XML file is mainly used to configure the action class corresponding to the request path and the result jump path.

Code Description: visit / example / HelloWorld Action corresponds to struts 2 Helloworldaction class under action package; The execute method in the class is executed by default. If you want to specify a method, you need to add the method attribute in the < action > tag< The result > tab configures the result jump path. According to the string returned by the method in the action class, match the name value in the result tag to jump.

3) On the web Configure the core controller in the XML file

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>