博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
tomcat6如何配置ssi使其支持shtml?
阅读量:5343 次
发布时间:2019-06-15

本文共 2698 字,大约阅读时间需要 8 分钟。

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 application

 

2.$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

转载于:https://www.cnblogs.com/qiewenhuan/p/4877156.html

你可能感兴趣的文章
RGB和HSB的转换推算
查看>>
Android 4.2蓝牙介绍
查看>>
MyBatis的底层实现原理
查看>>
如何实现基于ssh框架的投票系统的的质量属性
查看>>
SQL Server Profiler:使用方法和指标说明
查看>>
[What I should read] 基于windows server的分布式开发和部署
查看>>
Eclipse优化设置
查看>>
【注意事项】APP左右横滑设计
查看>>
linux中强大的screen命令
查看>>
js时间冒泡,阻止事件冒泡
查看>>
java面试题总结
查看>>
spring与quartz的整合
查看>>
Selenium-百度登录简单例子
查看>>
2014中国软件开发者调查(一):Java最受欢迎 第二语言JS使用比例最高
查看>>
词典 (noi OpenJudge)
查看>>
Visual Stdio 2010 抢先体验
查看>>
如何用ssh挂载远程目录
查看>>
常用的系统查询语句
查看>>
10651
查看>>
Leetcode: Convert Sorted List to Binary Search Tree
查看>>