1.去掉tomcat6中conf/web.xml关于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> <load-on-startup>4</load-on-startup> </servlet>
和
<servlet-mapping> <servlet-name>ssi</servlet-name> <url-pattern>*.shtml</url-pattern> </servlet-mapping>
重启tomcat,如果出现exception:
java.lang.SecurityException: Servlet of class org.apache.catalina.ssi.SSIServlet is privileged and cannot be loaded by this web application
修改:tomcat6.0/conf/context.xml文件
在标签<Context>里加入 privileged="true" 变为: <Context privileged="true">
如:tomcat6重启 以运行包含页面 但乱码; 修改tomcat6.0/conig/service.xml文件
添加:
<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>
修改成:
<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>
ok; .......