Strut2 环境配置

  • 格式:doc
  • 大小:2.12 MB
  • 文档页数:11

作者:莫怀远
1 / 11
Strut2 环境配置
配置使用的环境:
Myeclipse 8.5
jdk1.7.0_07
Tomcat6.07 (不需要安装)
struts-2.3.16-all

windows 7 64位 系统

目 录
1.新建一个web Project : ............................................................................................................. 2
2.配置 tomcat .................................................................................................................................. 3
3.配置jdk .......................................................................................................................................... 4
4.复制jar文件 ................................................................................................................................. 5
5.配置strut.xml 文件 ...................................................................................................................... 7
6.配置web.xml 文件 ....................................................................................................................... 9
7.新建相应的Hello.jsp..................................................................................................................... 9
作者:莫怀远

2 / 11
1.新建一个web Project :
作者:莫怀远

3 / 11
2.配置 tomcat
作者:莫怀远

4 / 11
3.配置jdk
作者:莫怀远

5 / 11
确认一下 jdk :

至此,struts2 框架搭好了!
4.复制jar文件
把以下的路径的jar文件 ,拷贝到
注:一般来说仅仅需要下面的7个jar包(版本可能一样),我是全部拷贝了。
commons-fileupload-1.3
commons-io-2.2 //写上传和下载的时候需要
commons-logging-1.1.3
freemarker-2.3.19
ognl-3.0.6
struts2-core-2.3.16
xwork-core-2.3.16
作者:莫怀远
6 / 11
拷贝到如下位置:
作者:莫怀远

7 / 11
5.配置strut.xml 文件
解压 Struct2 文件,得到文件如下图:

复制,以下路径中的struts.xml 文件,到最开始建立的项目的
src 目录 ,
作者:莫怀远

8 / 11
中的内容都注释掉 ,复制 之间的内容放在
中,并进行改写,结果如下:
extends="struts-default">


/error.jsp


exception="java.lang.Exception" result="error"/>


/Hello.jsp



作者:莫怀远
9 / 11
6.配置web.xml 文件
把以下路径中的文件的以下内容复制到,web.xml 中的 之间:


struts2

org.apache.struts2.dispatcher.ng.filter.Str
utsPrepareAndExecuteFilter


struts2
/*

7.新建相应的Hello.jsp
启动Tomcat ,用浏览器访问:http://localhost:8080/项目名/hello
以下是启动Tomcat 的一种方式:
作者:莫怀远

10 / 11
下面是另一种启动Tomcat 的方法:
作者:莫怀远

11 / 11
至此,全部完成!