1.官方参考文档地址:
2.配置步骤
(1)修改tomcat根目录下的
conf文件夹中的
context.xml,修改如下:
- <Context privileged="true">
- <!-- Default set of monitored resources -->
- <WatchedResource>WEB-INF/web.xml</WatchedResource>
- </Context>
(2)修改tomcat根目录下的conf文件夹中的web.xml,将SSI的Servlet的配置取消注释,并增加编码配置,否则可能出现乱码
- <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>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>
- <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>false</param-value>
- </init-param>
- <load-on-startup>4</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>ssi</servlet-name>
- <url-pattern>*.shtml</url-pattern>
- <url-pattern>*.html</url-pattern>
- </servlet-mapping>