2019独角兽企业重金招聘Python工程师标准>>>
(一)
先解压Struts-1.3.10-all.zip的文件夹Struts-1.3.10-all备用
-> 打开MyEclipse
-> 新建一个 web project
-> 在工程名上按右键鼠标选 Properties
-> 弹出 Properties 面板
-> 选Java Build Path
-> 选Libraries
-> 选Add External JARs
-> 选择刚才解压出来的文件夹下 /struts-1.3.10-all/struts-1.3.10/lib(lib下有许多 .JAR)
-> 全选(Ctrl+A)这些JAR
-> 选OK
(二)
打开WebRoot / WEB-INF文件夹
-> 右键鼠标选New
-> Other
-> 选MyEclipse下XML(Basic Templates)
-> 取名”struts-config.xml”
-> Finish
”struts-config.xml”中内容为:
<?xml version="1.0" encoding="UTF-8"?>
(三)
给”struts-config.xml”写入内容 (样本)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN""http://struts.apache.org/dtds/struts-config_1_3.dtd"><struts-config><form-beans /><action-mappings><action path="/aaa" forward="/aaa.jsp"></action></action-mappings></struts-config>
(四)配置编写:web.xml(样本)
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd"><servlet><servlet-name>action</servlet-name><servlet-class>org.apache.struts.action.ActionServlet</servlet-class><init-param><param-name>config</param-name><param-value>/WEB-INF/struts-config.xml</param-value></init-param><load-on-startup>0</load-on-startup></servlet><servlet-mapping><servlet-name>action</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping>
</web-app>
注:org.apache.struts.action.ActionServlet的寻找方式
Navigate -> Open Type -> 键入”actionservlet” -> “ActionServlet.class” ->
复制包名 “org.apache.struts.action.ActionServlet”