一、準備安裝程序 
1、jdk 5.0 安裝程序下載 
下載地址:
| https://jsecom15b.sun.com/ecom/ecomactionservlet/downloadpage:~:com.sun.sunit.sdlc.content.downloadpageinfo;jsessionid=502e87c71d77e3bc297c08b35dac9ad4;jsessionid=502e87c71d77e3bc297c08b35dac9ad4 | 
同意協議后,可以下載jdk-1_5_0_05-windows-i586-p.exe。 
2、tomcat 5.5.9下載 
下載地址:http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi 
最新版本是5.5.11alpha版,由于是測試版,所以,可能存在不確定的因素,所以,我們這里下載5.5.9 exe。 
3、sysdeo eclipse tomcat launcher plugin 3.1beta版下載 
下載地址:http://www.sysdeo.com/eclipse/tomcatplugin 
這里下載tomcatpluginv31beta.zip。 
4、eclipse 3.1安裝程序下載 
下載地址:http://www.eclipse.org/downloads/index.php 
這里需要對應版本的jdt,如果下載的是eclipse sdk版本就自帶了,如果沒有,同一個下載頁面的靠后部分有jdt的下載鏈接,下載后將對應的文件分別拷貝進eclipse安裝目錄下的對應的文件夾即可。 
這里我們下載eclipse-sdk-3.1-win32.zip 。 
5、gef 3.1 安裝程序下載 
下載地址: 
http://download.eclipse.org/tools/gef/downloads/drops/r-3.1-200507071758/ 
index.php 
這里我們下載gef-all-3.1.zip。 
6、eclipse html editor 1.6.7 安裝程序下載 
下載地址:https://sourceforge.jp/projects/amateras/files/?release_id=16537 
#16537 
這里我們下載:tk.eclipse.plugin.htmleditor_1.6.7.zip。 
7、strutside 1.1.7 安裝程序下載 
下載地址:https://sourceforge.jp/projects/amateras/files/?release_id=16537#16537 
這里我們下載:tk.eclipse.plugin.struts_1.1.7.zip。 
好了,到此我們準備好了所有的安裝包。
二、安裝jdk并配置開發環境 
這里只需要雙擊jdk安裝包的exe文件,按照提示安裝即可。安裝完成后,將jdk安裝目錄下的bin文件夾設置進環境變量的path路徑中去。同時,將jre的lib目錄下的rt.jar包設置進環境變量的classpath中去。 
這里我們把jdk安裝到了默認安裝路徑c:/program files/java/jdk1.5.0_02下。這里就不多說了,網上可以搜索到很多jdk安裝配置的文章。 
三、安裝tomcat服務器 
只需要雙擊tomcat安裝包的exe文件,按照提示安裝即可,這里我們的安裝目錄為d:/tomcat5.5,管理員密碼設置為12345678。 
四、安裝eclipse開發工具 
只需要把eclipse-sdk-3.1-win32.zip安裝包解壓,然后把里面的eclipse文件夾剪切至想放置的目錄即可,這里我們把eclipse安裝到了d:/eclipse目錄下。 
在安裝目錄下雙擊eclipse.exe文件,即可啟動eclipse。中間會詢問默認的工作目錄,你可以按其默認設定的,也可以自己設定工作目錄,這里設置為e:/workspace目錄。請選中use this as the default and do not ask again選項,這樣以后啟動就不會再詢問了。 
到此eclipse安裝成功。 
五、安裝tomcatplugin插件 
安裝很簡單,解壓我們已經下載的安裝包tomcatpluginv31beta.zip,將解壓后的com.sysdeo.eclipse.tomcat_3.1.0.beta文件夾拷貝至d:/eclipse/plugins目錄下即可。我們關掉已經打開的eclipse,重新打開,ok,現在我們會發現工具欄上多了幾個雄貓的圖標,就是tomcat的啟動、停止和重啟動的按鈕。打開eclipse的window/preferences,我們在左邊的樹種也可以找到tomcat一項。 
點擊tomcat項,在右邊我們選擇version 5.x版本,然后設定tomcat home為d:/tomcat5.5,contexts directory為d:/tomcat5.5/conf/catalina/localhost。到此tomcat plugin設置完畢。 
六、安裝gef插件 
同樣,將gef-all-3.1.zip解壓縮,然后拷貝解壓后的eclipse目錄下的三個文件夾到d:/eclipse目錄下,覆蓋所有的現有文件夾。 
好了,到此gef安裝完成。
八、創建測試工程 
如果已經完成了上面所有步驟,現在可以重新啟動eclipse,使新安裝的插件生效,開始正式開發了。 
1、使用sysdeo tomcat plugin創建tomcat工程: 
file->new->others,打開新建向導對話框,在樹中找到java->tomcat projects,選中,點擊next按鈕。在projects name中輸入textweb,選中use default,點擊next。在下一個對話頁面,保持默認設置,點擊finished。這時,我們在eclipse的package explorer中會看到新建的工程testweb,創建完成。 
2、加入struts框架 
file->new->others,打開新建向導對話框,找到amateras->struts->add struts support,選中點擊next按鈕。 
保持默認設置,點擊finish按鈕。這時,在eclipse的package explorer中會看到增加了很多struts的庫文件,在web-inf下也增加了很多struts的配置文件。到此我們已經在項目加入了struts框架。 
3、編輯struts-config.xml文件 
在web-inf文件夾下可以找到,右鍵點擊菜單中選擇open with->amateras xml editer可以直接對xml文本進行編輯,選擇open with->struts-config.xml editor可以在圖形模式下對文件進行編輯。 
在右邊的outline中點擊相應的struts對象可以添加新的對象進去。這里我們只是說明這里有一個比較方便的struts-config.xml文件的編輯器,后面我們將開發一個簡單的小程序。 
4、新建一個頁面index.jsp 
file->new->others,打開新建向導對話框,找到amateras->jsp file,點擊next按鈕,filename改為index.jsp,點擊finish。然后打開index.jsp文件進行編輯,內容如下: 
| <%@page pageencoding="gbk"contenttype="text/html; charset=gb2312" %><html><head><meta http-equiv="content-type"content="text/html; charset=gb2312"/><title></title></head><body><form name="form1" method="post" action="/testweb/logincheck.do"><table width="300"  border="0"cellspacing="0" cellpadding="0"><tr align="center"><td colspan="2">用戶登錄信息</td></tr><tr><td>用戶名</td><td><input name="username" type="text" id="username"size="12">user    </td></tr><tr><td>用戶密碼</td><td><input name="password" type="text" id="password" size="12">123456    </td></tr><tr align="center"><td colspan="2"><input type="submit" name="submit" value="提交"></td></tr></table></form></body></html> | 
5、創建form數據對象 
打開file->new->package對話框,name中輸入com.is.form,點擊finish按鈕。在右邊的package explorer樹中找到剛才創建的包,右鍵點擊com.is.form包,菜單中的new->others,找到amateras->struts->struts action form,點擊next,在對話框中name欄輸入loginform,點擊finish按鈕。 
編輯loginform類的內容為: 
| package com.is.form;import org.apache.struts.action.actionform;public class loginform extends actionform {private static final long serialversionuid = 1l;private string username = "";private string password = "";/*** @return returns the password.*/public string getpassword(){return password;} /*** @param password the password to set.*/public void setpassword(string password){ this.password = password;}/*** @return returns the username.*/public string getusername() {return username;}/*** @param username the username to set.*/public void setusername(string username) {this.username = username;}} | 
注意,這里的兩個屬性分別對應我們jsp中form中的兩個輸入控件的名稱,為什么這樣做,可以去看struts的幫助文檔了,我就不詳細說了,還有form類再寫完屬性后,get和set方法可以通過eclipse的source中的命令來自動生成,在右鍵菜單中,也不詳細說了,去網上查資料吧,關于eclipse的使用有很多的文檔。
七、安裝eclipse html editor插件 
解壓縮tk.eclipse.plugin.htmleditor_1.6.7.zip包,然后將plugins目錄拷貝至d:/eclipse目錄下覆蓋原文件夾即可。到此eclipse html editor插件安裝完成。 
八、安裝strutside插件 
解壓縮tk.eclipse.plugin.struts_1.1.7.zip包,然后將plugins目錄拷貝至d:/eclipse目錄下覆蓋原文件夾即可。 
好了,到此strutside插件安裝完成。 
6、創建action對象 
同創建form的過程相同,我們只是新建一個com.is.action包,同樣的過程,打開新建向導,只是選擇struts action,創建loginaction.java類,均選默認值。我們編輯loginaction為如下內容: 
| package com.is.action; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import org.apache.struts.action.action; import org.apache.struts.action.actionform; import org.apache.struts.action.actionforward; import org.apache.struts.action.actionmapping; import com.is.form.loginform; public class loginaction extends action { private static final long serialversionuid = 1l; public actionforward execute(actionmapping mapping, actionform form, httpservletrequest request,httpservletresponse response) throws exception { // this line is here for when theinput page is upload-utf8.jsp, // it sets the correct characterencoding for the response string encoding = request.getcharacterencoding(); if ((encoding != null) && (encoding.equalsignorecase("gb2312"))){ response.setcontenttype("text/html; charset=gb2312"); } else { response.setcontenttype("text/html; charset=gbk"); } try { if (form instanceof loginform) { loginform theform = (loginform) form; if(theform.getusername().equals("user") && theform.getpassword().equals("123456")) { return new actionforward("/welcome.do?type=true"); } else {                           return new actionforward("/welcome.do?type=false"); } } } catch (exception e) { } // this shouldn't happen in this example return null;    } } | 
注意這里是直接用actionforward轉向的,你也可以按照struts中提供的空白例程struts-blank.war中的做法進行轉向,可以比較一下會有收獲的。 
7、創建登錄成功頁面 
同創建index.jsp頁面相同,我們創建welcome.jsp頁面,均使用默認設置。并編輯其內容如下: 
| <%@page pageencoding="gbk" contenttype="text/html; charset=gbk" %><html> <head> <meta http-equiv="content-type" content="text/html;charset=gbk"/> <title></title> </head> <body> <% string type = request.getparameter("type"); if(type!=null&&type.equals("true")){ out.print("歡迎您的光臨!"); } else{ out.print("對不起,你輸入的用戶名或者密碼錯誤!"); } %> </body> </html> | 
8、增加struts-config.xml中的配置 
添加formbean的配置,在和標簽之間加入: 
| <form-bean name="loginform" type="com.is.form.loginform"/> | 
添加jsp文件的映射,在和標簽之間加入: 
| <action path="/index" forward="/index.jsp"/> <action path="/welcome" forward="/welcome.jsp"/> | 
添加action文件的映射,在和標簽之間加入: 
| path="/logincheck" type="com.is.action.loginaction" name="loginform" scope="request" validate="true"/> | 
修改后的struts-config.xml大致如下形式: 
| <?xml version="1.0"?> <!doctype struts-config public "-//apache software foundation//dtd struts configuration 1.2//en""http://struts.apache.org/dtds/struts-config_1_2.dtd"> <struts-config> <data-sources> </data-sources> <form-beans> <form-bean name="loginform" type="com.is.form.loginform"/> </form-beans> <global-exceptions> </global-exceptions> <global-forwards> </global-forwards> <action-mappings> <action path="/index" forward="/index.jsp"/> <action path="/welcome" forward="/welcome.jsp"/>    <action path="/logincheck" type="com.is.action.loginaction" name="loginform" scope="request" validate="true"/> </action-mappings>  <controller processorclass= "org.apache.struts.tiles.tilesrequestprocessor"/> <message-resources parameter="messageresources"/> <plug-in classname="org.apache.struts.tiles.tilesplugin"> <set-property property="definitions-config" value="/web-inf/tiles-defs.xml"/> <set-property property="moduleaware" value="true"/> </plug-in> <plug-in classname="org.apache.struts.validator.validatorplugin"> <set-property property="pathnames"value="/web-inf/validator-rules.xml,/web-inf/validation.xml"/> </plug-in> </struts-config> | 
到此我們可以運行測試程序了。 
9、運行測試程序 
右鍵點擊testweb工程根目錄,點擊菜單中的tomcate project->update context definition,將工程部署進tomcat,成功后會提示操作成功。 
點擊菜單欄中的雄貓圖標啟動tomcat,然后在ie地址欄中輸入http://localhost:8080/testweb/index.do,我們會看到index.jsp的頁面內容。