Cainiao developed using the Struts2 framework can definitely understand the user logon Program (1)

Source: Internet
Author: User

Struts2 execution process:

After the server is started, the user enters the action path to be requested in the address bar of the browser to access the web project on the server,

The built-in filter of struts2 captures the url address and performs conditional filtering. Locate from struts. xml based on the qualified request

Find the corresponding action, and then execute the corresponding action instance.


Seven core packages added by struts2: (packages may be different based on different versions)

1. Commons-fileupload-1.2.1.jar -------------- upload files

2. Commons-io-1.3.2.jar -------------- upload files

3. Commons-logging-1.0.4.jar

4. Freemarker. jar -------------- presentation layer framework, which defines the topic of the visual component of struts2

5. Ognl. jar -------------- OGNL Expression Language. struts2 supports this EL

6. Struts2-core.jar -------------- core library of struts2 2.0.11.2

7. Xwork. jar ------------ core library of webwork


Procedure:

1: import the six packages that struts2 depends on;

Note: Do not import unnecessary packages during package export. Otherwise, package conflicts may occur. Alternatively, you cannot directly copy the package from another project in MyEclipse. You must find the package from the original file before copying it.

2: add the struts 2.1 feature-> struts. xml configuration file.

Change the <filter-class> self-contained in the struts. xml file to the following content (filter writing in the earlier version of struts2 ).

<Filter-class>

Org. apache. struts2.dispatcher. FilterDispatcher

</Filter-class>

3: add an entity object.

4: Add and implement the dao interface.

5: Add and implement the service interface, and use the method in dao.

6: Add action and use the method in service.

7. Add an input/output view.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.