Eclipse Downloads Java EE version, here with 4.5 (Mars).
TOMCAT8 decompression, set the JAVA_HOME environment variable.
Download the Lib package from the Struts2 website, struts-2.3.24-lib.zip, and unlock the jar pack that contains more than 100 of the jars we might use.
Download Struts2 Online example Pack, Struts-2.3.24-apps.zip, untie
Navigate to the blank example: Struts-2.3.24\apps\struts2-blank, the main content is in its Web-inf directory.
1. Create a new project, Dynamic Web project, use the next wizard, do not directly finish, and finally choose to build Web. Xml.
2. Copy the *.jar file under Web-inf\lib in the example to the Web-inf\lib directory of the new project.
3. Locate the Web. XML in the example Web-inf, and copy the following, under the Web-inf Web. XML node under the new project.
<Filter> <Filter-name>Struts2</Filter-name> <Filter-class>Org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</Filter-class> </Filter> <filter-mapping> <Filter-name>Struts2</Filter-name> <Url-pattern>/*</Url-pattern> </filter-mapping>
This means that struts2 will be used to intercept all access requests and how the request distribution needs to be configured in Struts.xml.
4. Locate the instance: \web-inf\src\java\struts.xml file and copy it to the SRC folder of the new project.
Comment out the contents of all <struts> tags and add the following:
< Packagename= "Default"namespace="/"extends= "Struts-default"> <Actionname= "H"> <result>/hehe.jsp</result> </Action></ Package>
This defines the relative url:.../h or .../h.action will use hehe.jsp as the output response.
5. Create the hehe.jsp file and add it to the,<body> tag in the automatically generated HTML:
6. Save all files and confirm that no error has been filed. Servers Select Tomcat8, right-click, start, see Tomcat is started.
Browser input: http://localhost:8080/project name/h
You should be able to see the output of the JSP page.
Eclipse uses struts2 to develop web App quick build