程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> 關於JAVA >> tomcat如何開啟與配置ssi

tomcat如何開啟與配置ssi

編輯:關於JAVA
 

修改web.xml文件

本文已apache-tomcat-6.0.29為講解示例,其他版本的tomcat配置與之相同
1、打開apache-tomcat-6.0.29\conf\web.xml 配置文件
2、去掉文件298行左右關於ssi配置的注釋,具體去掉注釋的代碼如下:

 

<servlet>
	<servlet-name>ssi</servlet-name>
	<servlet-class>
	  org.apache.catalina.ssi.SSIServlet
	</servlet-class>
	<init-param>
	  <param-name>buffered</param-name>
	  <param-value>1</param-value>
	</init-param>
	<init-param>
	  <param-name>debug</param-name>
	  <param-value>0</param-value>
	</init-param>
	<init-param>
	  <param-name>expires</param-name>
	  <param-value>666</param-value>
	</init-param>
	<init-param>
	  <param-name>isVirtualWebappRelative</param-name>
	  <param-value>0</param-value>
	</init-param>
	<init-param>
	  <param-name>inputEncoding</param-name>
	  <param-value>GBK</param-value>
	</init-param>
	<init-param>
	  <param-name>outputEncoding</param-name>
	  <param-value>GBK</param-value>
	</init-param>
	<load-on-startup>4</load-on-startup>
</servlet>

其中以下代碼為可選項,可以在以上模塊中不加入:

<init-param>
  <param-name>inputEncoding</param-name>
  <param-value>GBK</param-value>
</init-param>
<init-param>
  <param-name>outputEncoding</param-name>
  <param-value>GBK</param-value>
</init-param>

3、去掉文件405行左右關於ssi配置的注釋,具體去掉注釋的代碼如下:

 <servlet-mapping>
	<servlet-name>ssi</servlet-name>
	<url-pattern>*.shtml</url-pattern>
</servlet-mapping>

4、關於web.xml475行左右的filter不用開啟

修改context.xml文件

1、打開apache-tomcat-6.0.29\conf\context.xml配置文件
2、在文件19行Context節點中加入privileged=”true” 加入完之後的配置如下:

<Context privileged="true">
    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->
</Context>
 
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved