tomcat6.0添加ssi(*.shtml)配置

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></param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>expires</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>isVirtualWebappRelative</param-name>
<param-value></param-value>
</init-param>
<load-on-startup></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-</param-value>
</init-param>
<init-param>
<param-name>outputEncoding</param-name>
<param-value>utf-</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></param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>expires</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>isVirtualWebappRelative</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>inputEncoding</param-name>
<param-value>utf-</param-value>
</init-param>
<init-param>
<param-name>outputEncoding</param-name>
<param-value>utf-</param-value>
</init-param>
<load-on-startup></load-on-startup>
</servlet>

ok; .......

上一篇:拖动DIV


下一篇:jQuery编写插件--封装全局函数的插件(一些常用的js验证表达式)