Tomcat6版的配置方法:
1.在$CATALINA_BASE/conf/目录下找到web.xml文件 使用SSI Servlet的话删除在SSI servlet和servlet-mapping周围的注释,使用SSI filter的话删除在SSI filter和filter-mapping周围的注释=============================================================================================
<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> <load-on-startup>4</load-on-startup> </servlet>==============================================================================================
<servlet-mapping>
<servlet-name>ssi</servlet-name> <url-pattern>*.shtml</url-pattern> </servlet-mapping>=================================tomcat6重启 出错=================================
java.lang.SecurityException: Servlet of class org.apache.catalina.ssi.SSIServlet is privileged and cannot be loaded by this web application2.$CATALINA_BASE/conf/下还有一个context.xml,将里面的<Context>改成<Context privileged="true">==================================修改context.xml==================================在标签<Context>里加入 privileged="true"变为:<Context privileged="true">
3.解决乱码问题
在$CATALINA_BASE/conf/web.xml中的ssi servlet配置中添加以下初始配置: <init-param> <param-name>inputEncoding</param-name> <param-value>utf-8</param-value> </init-param> <init-param> <param-name>outputEncoding</param-name> <param-value>utf-8</param-value> </init-param>其中utf-8编码应该和你页面的编码方式一样
修改为:
<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>utf-8</param-value> </init-param> <init-param> <param-name>outputEncoding</param-name> <param-value>utf-8</param-value> </init-param> <load-on-startup>4</load-on-startup> </servlet>===========================重启tomcat6 仍乱码========================================过一两分钟再重启tomcat6 不乱码了=================== 更多请参考官方的配置说明http://tomcat.apache.org/tomcat-6.0-doc/ssi-howto.html