配置 JSP 引擎參數
瞭解如何新增、變更或刪除 JSP 引擎配置參數。
關於此作業
下列附註適用於這個主題中,副檔名為 .xmi 的檔案參照:
WebSphere® Application Server 不支援透過「管理主控台」或管理 Scripting 來修改部署描述子延伸參數。支援的配置: 對於 IBM® 延伸和連結檔, 根據您是使用Java™ EE 5 之前的應用程式或模組,還是使用 Java EE 5 或更新版本的應用程式或模組, .xmi 或 .xml 副檔名會有所不同。 IBM 延伸或連結檔命名為 ibm-*-ext.xmi 或 ibm-*-bnd.xmi ,其中 * 是延伸或連結檔的類型,例如 app、 application、 ejb-jar或 web。 適用下列條件:
不過, Java EE 5 或更新版本的模組可以存在於包含Java EE 5 之前的檔案且使用 .xmi 副檔名的應用程式內。
ibm-webservices-ext.xmi、 ibm-webservices-bnd.xmi、 ibm-webservicesclient-bnd.xmi、 ibm-webservicesclient-ext.xmi及 ibm-portlet-ext.xmi 檔案會繼續使用 .xmi 副檔名。
最佳作法: 使用組合工具 (例如 Rational Application Developer) 來修改 IBM 延伸和連結檔。 您可以利用 IBM Bindings and Extensions Conversion Tool for Multi-Platforms,將模組內的延伸和連結檔從 XMI 轉換為 XML。
如果要新增、變更或刪除 JSP 引擎配置參數,請完成下列步驟:
程序
範例
以下是 WEB-INF/ibm-web-ext.xmi 檔的範例。 粗體指令行是 JSP 引擎配置參數。
<?xml version="1.0" encoding="UTF-8"?>
<webappext:WebAppExtension xmi:version="2.0" xmlns:xmi=http://www.omg.org/XMI
xmlns:webappext="webappext.xmi" xmlns:webapplication="webapplication.xmi" xmi:id="WebAppExtension_1"
reloadInterval="9" reloadingEnabled="true" defaultErrorPage="error.jsp" additionalClassPath=""
fileServingEnabled="true" directoryBrowsingEnabled="false" serveServletsByClassnameEnabled="true"
autoRequestEncoding="true" autoResponseEncoding="false">
<webApp href="WEB-INF/web.xml#WebApp_1"/>
<jspAttributes xmi:id="JSPAttribute_1" name="useThreadTagPool" value="true"/>
<jspAttributes xmi:id="JSPAttribute_2" name="verbose" value="false"/>
<jspAttributes xmi:id="JSPAttribute_3" name="deprecation" value="false"/>
<jspAttributes xmi:id="JSPAttribute_4" name="reloadEnabled" value="true"/>
<jspAttributes xmi:id="JSPAttribute_5" name="reloadInterval" value="5"/>
<jspAttributes xmi:id="JSPAttribute_6" name="keepgenerated" value="true"/>
<!--<jspAttributes xmi:id="JSPAttribute_7" name="trackDependencies" value="true"/> -->
</webappext:WebAppExtension>
以下是
WEB-INF/ibm-web-ext.xml 檔的範例。 粗體指令行是 JSP 引擎配置參數。<?xml version="1.0" encoding="UTF-8"?>
<web-ext
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd"
version="1.0">
<default-error-page uri="error.jsp"/>
<jsp-attribute name="useThreadTagPool" value="true" />
<jsp-attribute name="verbose" value="false" />
<jsp-attribute name="deprecation" value="false" />
<jsp-attribute name="reloadEnabled" value="true" />
<jsp-attribute name="reloadInterval" value="5" />
<jsp-attribute name="keepgenerated" value="true" />
<jsp-attribute name="trackDependencies" value="true" />
<reload-interval value="9"/>
<auto-encode-requests value="true"/>
<auto-encode-responses value="false"/>
<enable-directory-browsing value="false"/>
<enable-file-serving value="false"/>
<pre-compile-jsps value="false"/>
<enable-reloading value="true"/>
<enable-serving-servlets-by-class-name value="true"/>
</web-ext>注意: JSPattribute_n 中的整數 n 在檔案內必須是唯一的。