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.