New term, new weather!
I used Myeclipse 2017 CI. I didn't crack Myeclipse by myself, or I cracked it according to Myeclipse cracking installation package & tutorial I uploaded Crack!
If you are using eclipse ee, download it yourself struts 2.0 After decompressing, copy and paste the required jar package into the lib folder of the Web project.
There are four commonly used jar packages:
Here is my Myeclipse project directory: (ignore the auto generated index.jsp)
Step 1: right click Project / configure faces / install... (2.x)Facets
Step 2: (the URL pattern in Figure 2 is changed to "/ *", and the default settings in Figure 1 and figure 3 are OK.)
Step 3: observation (red box)
Hello.jsp (if it runs successfully, the page will display "Hello,struts hehehehehe")
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Welcome interface</title> </head> <body> <h2><s:property value="message"/></h2> </body> </html>
Hello.java
package tutorial; import com.opensymphony.xwork2.ActionSupport; public class Hello extends ActionSupport{ public static final String MESSAGE = "Hello,struts hehehehehe"; public String execute() throws Exception{ setMessage(MESSAGE); return SUCCESS; } private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
struts.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN" "http://struts.apache.org/dtds/struts-2.1.7.dtd"> <struts> <package name="default" extends="struts-default"> <action name="Hello" class="tutorial.Hello"> <result>/Hello.jsp</result> </action> </package> </struts>
If the page is blank, change the file suffix at the end of the url to. action (formerly. jsp)