移轉 Struts Web 專案

針對 WebSphere® Studio 5.1.x 版中建立的 Struts Web 專案,您必須稍微修改 Web 專案的部署描述子,才能在 WebSphere Application Server 6.0 版執行 EAR 專案。您可能也想要將現有的 Struts 1.0.2 或 Struts 1.1 測試版(2 或 3)Web 專案,手動轉換至 Struts 1.1。

修改現有 Struts Web 專案的部署描述子

當 Struts 專案是在 WebSphere Studio 5.x 版中建立時,Web 專案之部署描述子中的 config 參數 (<param-name>config</param-name>) 會設為 WEB-INF/struts-config.xml。WebSphere Application Server 6.0 版這個參數的開頭需要有 "/"。如果您在 WebSphere Application Server 6.0 版執行於 WebSphere Studio 5.1.x 版建立的 Struts Web 專案,您可能會在啟動 EAR 專案時收到 java.net.MalformedURLException 異常狀況。

註: Rational® Application Developer 6.0 版會在建立新的 Struts 專案時加入 "/";不過,在從 WebSphere Studio 5.1x 版移轉時,必須手動加入。
請遵循下列步驟在 6.0 版中,更正 WebSphere Studio 5.1.x 版建立之 Struts Web 專案的部署描述子:
  1. 在「專案瀏覽器」中開啟 Struts Web 專案。
  2. 在「專案瀏覽器」中,按兩下 Web 專案的 Web 部署描述子檔。 這時會開啟 Web 部署描述子編輯器。
  3. 按一下程式碼標籤來開啟「程式碼」頁面。
  4. 變更下面這一行

    <param-value>WEB-INF/struts-config.xml</param-value>(這位於 <servlet></servlet> 標示內)

    to

    <param-value>/WEB-INF/struts-config.xml</param-value>

  5. 儲存 Web 部署描述子
當 EAR 專案重新啟動時,不應發生 java.net.MalformedURLException 異常狀況。

將 Struts 1.1 測試版 Web 專案轉換至 Struts 1.1

在 WebSphere Studio 5.1.x 版中,Struts 執行時期程式庫會從 5.0.x 版中的 Struts 1.1 測試版(2 或 3)逐步升級到 Struts 1.1(最終版)。 如果您有現有的 Struts 1.1 測試版(2 或 3)Web 專案,且要轉換至 Struts 1.1(最終版),您可能要手動轉換。 (附註:您不需要將 Struts 1.1 測試版(2 或 3)專案轉換至 Struts 1.1。)

若要將 Struts 1.1 測試版(2 或 3)專案轉換至 Struts 1.1,請執行下列動作:
  1. 將 Struts 1.1 測試版專案載入 Rational Application Developer 6.0 版工作區中。
  2. 建立新的 Struts 1.1 Web 專案,比方說,名稱為 Struts11。 您需要建立這個暫時專案,以便存取在轉換實際的專案時,所需的 Struts 1.1 執行時期檔案。完成之後,您可以刪除這個專案。
  3. 針對要轉換至 Struts 1.1 的 Struts 1.1 測試版專案,執行下列動作:
    1. 從您專案的 Web Content/WEB-INF/lib 目錄刪除下列 JAR 檔:
      • commons-*.jar.
      • struts.jar.
    2. 將下列 JAR 檔從 Struts11/WebContent/WEB-INF/lib 目錄複製到您專案的 Web Content/WEB-INF/lib 目錄中:
      • commons-*.jar.
      • struts.jar.
    3. 從專案的 Web Content/WEB-INF 目錄刪除下列「標示庫描述子」(TLD) 檔案:struts-*.tld。
    4. 將下列 TLD 檔從 Struts11/WebContent/WEB-INF 目錄複製到專案的 Web Content/WEB-INF 目錄中:struts-*.tld。

將 Struts 1.0.2 Web 專案轉換至 Struts 1.1

在 WebSphere Studio 5.1.x 版(和 5.0.x 版)中,當您新增 Struts 支援到 Web 專案時,您可以選擇 Struts 1.0.2。 如果您有現有的 Struts 1.0.2 Web 專案,且要轉換至 Struts 1.1,您可能要手動轉換。 (附註:您不需要將 Struts 1.1 測試版(2 或 3)專案轉換至 Struts 1.1。)

若要將 Struts 1.0.2 專案轉換至 Struts 1.1,請執行下列動作:
  1. 將 Struts 1.0.2 專案載入 Rational Application Developer 6.0 版工作區中。
  2. 建立新的 Struts 1.1 Web 專案,比方說,名稱為 Struts11。 您需要建立這個暫時專案,以便存取在轉換實際的專案時,所需的 Struts 1.1 執行時期檔案。完成之後,您可以刪除這個專案。
  3. 針對要轉換至 Struts 1.1 的 Struts 1.0.2 專案,執行下列動作:
    1. 從您專案的 Web Content/WEB-INF/lib 目錄刪除 struts.jar 檔。
    2. 將下列 JAR 檔從 Struts11/WebContent/WEB-INF/lib 目錄複製到您專案的 Web Content/WEB-INF/lib 目錄中:
      • commons-*.jar.
      • struts.jar.
      • jarkarta-oro.jar.
    3. 從您專案的 Web Content/WEB-INF 目錄刪除下列「標示庫描述子」(TLD) 檔案:struts-*.tld。
    4. 將下列 TLD 檔從 Struts11/WebContent/WEB-INF 目錄複製到您專案的 Web Content/WEB-INF 目錄中:struts-*.tld。
相關概念
WebSphere Studio 5.1.x 版的相容性
相關參考
6.0 版的除錯器變更
WDO 至 SDO 移轉
6.0 版中的 EGL 保留字
意見
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.