Tomcat supports SHML Configuration

Source: Internet
Author: User

Tomcat 5.x
1. Rename the servlets-ssi.renametojar file under the Tomcat server \ lib directory to the servlets-ssi.jar.

2. Modify the Web. xml file in the conf directory of Tomcat and find the followingCode:

<Servlet-Name> SSI </servlet-Name>
Org. Apache. Catalina. ssi. SSIServlet
<Param-Name> buffered </param-Name>
<Param-value> 1 </param-value>
<Param-Name> debug </param-Name>
<Param-value> 0 </param-value>
<Param-Name> expires </param-Name>
<Param-value> 666 </param-value>
<Param-Name> isvirtualwebapprelative </param-Name>
<Param-value> 0 </param-value>
<Load-on-startup> 4 </load-on-startup>
Remove the annotator, that is, delete/* at the top of the code and */at the bottom of the Code.

3. Remove the comments of servlet ing, that is, remove the comments in the following code.

<Servlet-Name> SSI </servlet-Name>
<URL-pattern> *. shtml </url-pattern>

4. Restart tomcat.

Tomcat version 6.x
You may also encounter: Java. Lang. securityexception: Filter of class org. Apache. Catalina. ssi. SSIFilter is privileged and cannot be loaded by this Web Application

Tomcat 6 SSI configuration and 5. different Versions of X, according to the online search results, 5. XX to be changed. jar files, and 6. x, but this file does not exist.

1. The first thing that comes to mind is to read the official documentation Documentation.

$ Catalina_base/CONF/Web. xml file

SSI-related servlet-mapping filter-Mapping Annotation is removed.

2. Start, error, and a security exception is reported,

Java. lang. securityexception: Filter of class Org. apache. catalina. SSI. SSIFilter is privileged and cannot be loaded by this web application. You can also read the following sentence: only contexts which are marked as privileged may use SSI features (see the privileged property of the context element ).

[1] privileged = "true" is added to the context of the current project under $ catalina_base/CONF/servlet. xml.

3. In my version 6.0.13

$ Catalina_base/CONF/has a context. XML element, which is added with the privileged = "true" attribute, and then started again.

Supplement: The above configuration does not solve the garbled problem.

Garbled solution: In

Add the following initial configuration to the SSI servlet configuration in $ catalina_base/CONF/Web. xml:


<Param-Name> inputencoding </param-Name>

<Param-value> UTF-8 </param-value>



<Param-Name> outputencoding </param-Name>

<Param-value> UTF-8 </param-value>



UTF-8 should be encoded in the same way as your page.

On the shtml page

<! -- # Include file = "test.html" --> You can reference static files.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.