文章只是做一个记录,以便日后查阅
本人技术有限,有误的地方请友善指出,谢谢,O(∩_∩)O~
工具:myeclipse8.5
数据库:mysql
使用框架:struts2.3 + hibernate3 + spring3.0 + junit4
1,新建一个web项目,其他的就不多说了
2,新建一个user libraries ,此处取名struts,导入需要的基础包
[img]http://dl.iteye.com/upload/picture/pic/129059/5fe787e5-d3ce-3968-b0f1-5f9ddf31f546.jpg[/img]
3,配置web.xml
<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>
4,添加action类
package action;
import com.opensymphony.xwork2.ActionSupport;
public class TestStrutsAction extends ActionSupport {
private static final long serialVersionUID = -5561563641398878951L;
public String execute() throws Exception {
System.out.println("run execute method.....");
return SUCCESS;
}
}
5,配置struts.xml【文件添加到src下面】
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<action name="index" class="action.TestStrutsAction">
<result name="success">index.jsp</result>
</action>
</package>
</struts>
6,展示一下最后的结构
[img]http://dl.iteye.com/upload/picture/pic/129061/eff60986-e0f5-34ab-ab6b-2c67bc137ae2.jpg[/img]
本人技术有限,有误的地方请友善指出,谢谢,O(∩_∩)O~
工具:myeclipse8.5
数据库:mysql
使用框架:struts2.3 + hibernate3 + spring3.0 + junit4
1,新建一个web项目,其他的就不多说了
2,新建一个user libraries ,此处取名struts,导入需要的基础包
[img]http://dl.iteye.com/upload/picture/pic/129059/5fe787e5-d3ce-3968-b0f1-5f9ddf31f546.jpg[/img]
3,配置web.xml
<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>
4,添加action类
package action;
import com.opensymphony.xwork2.ActionSupport;
public class TestStrutsAction extends ActionSupport {
private static final long serialVersionUID = -5561563641398878951L;
public String execute() throws Exception {
System.out.println("run execute method.....");
return SUCCESS;
}
}
5,配置struts.xml【文件添加到src下面】
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<action name="index" class="action.TestStrutsAction">
<result name="success">index.jsp</result>
</action>
</package>
</struts>
6,展示一下最后的结构
[img]http://dl.iteye.com/upload/picture/pic/129061/eff60986-e0f5-34ab-ab6b-2c67bc137ae2.jpg[/img]