Struts 2-set up Hello world under struts2

Source: Internet
Author: User

Struts 2-set up Hello world under struts2
1. Hello World under Struts 2

1. Create a new Web Project named HelloWorld

2. Window-> Preferences-> tomcat select the downloaded tomcat

3. Window-> Preferences-> Java-> Installed JREs select the local jre

4. Decompress Struts-2.3.20 \ apps \ struts2-blank.war in struts 2 File

5. Copy struts-2.3.20 \ apps \ struts2-blank \ WEB-INF \ classes \ struts. xml to the src directory of the HelloWorld Project

6. Copy all files under struts-2.3.20 \ apps \ struts2-blank \ WEB-INF \ lib to the WebRoot \ WEB-INF \ lib directory

7. Copy struts-2.3.20 \ apps \ struts2-blank \ WEB-INF \ web. xml to the web. xml of the HelloWorld Project

Xmlns = "http://java.sun.com/xml/ns/javaee"

Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"

Xsi: schemaLocation = "http://java.sun.com/xml/ns/javaee

Http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd>

Index. jsp

Struts2

Org. apache. struts2.dispatcher. ng. filter. StrutsPrepareAndExecuteFilter

Struts2

/*

8. Modify Struts. xml

"-// Apache Software Foundation // DTD Struts Configuration 2.3 // EN"

Http://struts.apache.org/dtds/struts-2.3.dtd>

/Hello. jsp

9. Deploy and access the project

Http: // localhost: 8080/HelloWorld/hello. action

PS:

(1) configure the following line in struts. xml:

When you modify the configuration, you do not need to restart the server.

(2) how to view the source code:

Select the jar file to be viewed, right-click Properetie-> Java Source Attachment-> Externsl Folder-> struts-2.3.20/src/core/src/main/java

Click the class file in the jar file again to view the source code.

(3) view Javadoc

Select the jar file to be viewed, right-click Properetie-> Javadoc Location-> struts-2.3.20/docs/struts2-core-apidocs/

After the configuration is complete, select any class, such as org. apache. struts2.dispatcher. ng. filter. StrutsPrepareAndExecuteFilter. Press f1, The Javadoc file of this class will appear.






Related Article

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.