首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

在Eclipse Helios 3.6.2下配置Struts2开发环境

2012-10-06 
在Eclipse Helios 3.6.2上配置Struts2开发环境1. 下载Eclipse登录Eclipse官网下载http://www.eclipse.org/

在Eclipse Helios 3.6.2上配置Struts2开发环境
1. 下载Eclipse
登录Eclipse官网下载http://www.eclipse.org/downloads/
我选择的是Eclipse Classic 3.6.2, 32位

2. 添加Web and Java EE开发工具
Help -> Install new software,在"Work with:"下拉框中选中"Helios - http://download.eclipse.org/releases/helios"(如果没有,可以自行添加),然后在"Web, XML, and Java EE Development"中选择
  - Eclipse Java EE Developer Tools
  - Eclipse Web Developer Tools
  - JST Server Adapters (创建Apache Tomcat Server需要)

3. 下载Tomcat
登录Apache Tomcat官网下载http://tomcat.apache.org/
我选择的是Tomcat 7.0.14

4. 添加Tomcat插件
http://www.eclipsetotale.com/tomcatPlugin.html
这个好像没有官网,也没有update site
下载后解压,复制到plugin目录下,然后重启eclips即可

5. 创建Web工程
File -> New -> Project -> Dynamic Web Project

6. 添加Struts 2类库
登录Struts官网下载http://struts.apache.org/downloads.html
我选择的是struts-2.2.3-lib.zip
下载后解压,把Struts 2必须的核心类库复制到到Web工程的WebContent/WEB-INF/lib下
  - commons-fileupload-1.2.2.jar
  - commons-io-2.0.1.jar
  - commons-lang-2.5.jar
  - commons-logging-1.1.1.jar
  - freemarker-2.3.16.jar
  - javassist-3.11.0.GA.jar
  - ognl-3.0.1.jar
  - struts-core-1.3.10.jar
  - xwork-core-2.2.3.jar

7. 新建web.xml
不知道为什么,工程创建的时候没有web.xml,不过没有关系,我们可以自己建
文件位置:/WebContent/WEB-INF/web.xml
内容



8. 新建struts.xml
文件位置:/WebContent/WEB-INF/classes/struts.xml
内容


9. 创建Server
File -> New -> Server
"Server Type"我选择了"Tomcat v7.0 Server",然后把新建的Web工程移动到"Configured"中就可以了

这样基本就搭建好Struts 2的结构了

热点排行