從 WebSphere Application Server 5.x 版移轉 Web 應用程式元件
WebSphere® Application Server 舊版中所部署的 Web 應用程式不需要移轉。 除非 Servlet 3.1 或 JSP 2.3 規格的行為有了改變,否則,Java™ Servlet 2.2 版以及更新版本的規格,以及 JavaServer Pages (JSP) 1.2 和 1.4 版的規格,仍受到支援。 相應的規格中通常會更詳細說明這些變更。
關於這項作業
在下列實例中,可能需要考慮移轉 Servlet:
- 實作 WebSphere Application Server 內部 Servlet 來略過 WebSphere Application Server 4.x 版單一應用程式路徑限制
- 延伸 PageListServlet,而它依賴 Servlet 配置 XML 檔中的配置資訊
- 利用 encodeRedirectURL 函數或從非環境定義根目錄內開始,呼叫 Servlet 的 response.sendRedirect 方法
- 取決於設定預設的 Content-Type 回應標頭,或呼叫 getWriter 之後,setContentType 呼叫的行為。
這個行為是由 WebSphere Application Server 版本層次,利用 Web 儲存器自訂內容 com.ibm.ws.webcontainer.contenttypecompatibility 來設定,其值為 V4、V5、V6 或 V7。
表 1 說明每一個版本的行為。
表 1. Web 儲存器自訂內容。. 說明每一個版本的版本行為。 第 4 版 第 5 版 第 6 版 第 7 版 預設 Content-Type text/html text/html; charset= <default_ encoding> 無 無 如果 Charset 不存在於 Content-Type,則在 getWriter 上附加此內容 範例:response.setCharacterEncoding("UTF-8"); response.setContentType("text/xml"); response.getWriter();
text/html text/html text/xml; charset=UTF-8 text/xml; charset=UTF-8 如果 getWriter 之後使用 ";charset=" 部分呼叫 setContentType 內容,則從 Content-Type 內容中移除 charset 範例:setContentType("text/html;charset=ISO-8859-7"); getWriter(); setContentType("text/xml;charset=UTF-8");
text/html text/html text/html text/xml; charset=ISO-8859-7
如果應用程式參照未命名套件中的 JSP 頁面實作類別,或您將 WebSphere Application Server 4.x 版 EAR 檔(利用 JSP Precompile 選項部署在 4.x 版中)安裝在 5.x 版中,可能需要考慮移轉 JSP。
從 WebSphere Application Server 5.x 版移轉時,您需要重新編譯所有 JSP 頁面。
如果應用程式參照未命名套件中的 JSP 頁面實作類別,或您將 WebSphere Application Server 4.0.1 版 EAR 檔(利用 JSP Precompile 選項部署在 4.0.1 版中)安裝在 5.x 版中,可能需要考慮移轉 JSP。
從 WebSphere Application Server 5.x 版移轉時,您需要重新編譯所有 JSP 頁面。

不過,即使應用程式含有 Java EE 5 之前的檔案,且所用的副檔名是 .xmi,其中也可以有 Java EE 5 或更新版本的模組。
ibm-webservices-ext.xmi、ibm-webservices-bnd.xmi、ibm-webservicesclient-bnd.xmi、ibm-webservicesclient-ext.xmi 和 ibm-portlet-ext.xmi 檔會繼續使用 .xmi 副檔名。
sptcfg如果 Web 應用程式發生移轉問題,請遵循這些步驟: