這裏顯示二個版本的差異處。
struts [2009/02/12 10:04] bestlong |
struts [2011/03/21 13:22] (目前版本) bestlong |
||
---|---|---|---|
行 2: | 行 2: | ||
* [[http://struts.apache.org/|Struts]] | * [[http://struts.apache.org/|Struts]] | ||
+ | * [[eclipse_struts1|在 Eclipse 使用 Struts 1.3.x]] | ||
+ | * [[eclipse_struts2|在 Eclipse 使用 Struts 2.x.x]] | ||
- | ===== 在 Eclipse 使用 Struts 1.3.x ===== | ||
- | ==== 建立支援 Struts 的專案環境 ==== | ||
- | 1. Eclipse 中建立一個 Dynamic Web Project 然後 | ||
- | |||
- | 2. 將 Struts 的 lib 下的檔案都複製到 WebContent/WEB-INF/lib 目錄下 | ||
- | |||
- | 3. 將 Struts 的 src\taglib\src\main\resources\META-INF\tld 下的 *.tld 複製到 WebContent/WEB-INF/lib | ||
- | |||
- | 4. 在 WebContent/WEB-INF 目錄下建立 struts-config.xml 內容如下: | ||
- | |||
- | <?xml version="1.0" encoding="UTF-8"?> | ||
- | <!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 /> | ||
- | <form-beans /> | ||
- | <global-exceptions /> | ||
- | <global-forwards /> | ||
- | <action-mappings /> | ||
- | <message-resources parameter="struts.ApplicationResources" /> | ||
- | </struts-config> | ||
- | |||
- | 5. 修改 WebContent/WEB-INF/web.xml 增加處理 Struts 動作的 ActionServlet 的設定,內容下: | ||
- | |||
- | <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> | ||
- | <init-param> | ||
- | <param-name>debug</param-name> | ||
- | <param-value>3</param-value> | ||
- | </init-param> | ||
- | <init-param> | ||
- | <param-name>detail</param-name> | ||
- | <param-value>3</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> | ||
- | ==== 建立首頁(index.jsp) ==== | ||
- | 待續... |