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>
<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>
<servlet-mapping>
<servlet-name>ssi</servlet-name>
<url-pattern>*.shtml</url-pattern>
</servlet-mapping>
*第一段中需要加上解析中文编码  
<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>
context.xml 为 Context 加上  privileged="true" 属性 例如: <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>
不多说直接上代码

/Files/qzsonline/web.xml

/Files/qzsonline/context.xml  

SSI用法:

必须为*.shtml页面加载 例如:index.shtml

<!-- header -->
<!--#include virtual="header.html" -->
<!-- news -->
<!--#include virtual="news.html" -->
<!-- guild -->
<!--#include virtual="guild.html" -->
<!-- service -->
<!--#include virtual="service.html" -->
<!-- friendLink -->
<!--#include virtual="friendLink.html" -->
<!-- footer -->
<!--#include virtual="footer.html" -->
转载自:http://www.cnblogs.com/qzsonline/archive/2012/01/06/2314035.html
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐