WEB开发网
开发学院WEB开发Jsp tomcat下如何才能运行shtml文件? 阅读

tomcat下如何才能运行shtml文件?

 2009-04-29 16:35:31 来源:WEB开发网   
核心提示:我们知道,需要运行shtml,tomcat下如何才能运行shtml文件?,必须在web服务器上配置好ssi,下面是ssi在tomcat5.*上的配置方法:打开tomcat配置文件:conf/web.xml:1、去掉下面servlet前的注释/* <servlet><servlet-name>ss

我们知道,需要运行shtml,必须在web服务器上配置好ssi。
下面是ssi在tomcat5.*上的配置方法:

打开tomcat配置文件:conf/web.xml:
1、去掉下面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>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>
<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>

2、去掉servlet映射的注释

/*<servlet-mapping>
<servlet-name>ssi</servlet-name>
<url-pattern>*.shtml</url-pattern>
</servlet-mapping>
*/

改成

<servlet-mapping>
<servlet-name>ssi</servlet-name>
<url-pattern>*.shtml</url-pattern>
</servlet-mapping>

3、在server\lib目录中找到servlets-ssi.renametojar文件,改成 servlets-ssi.jar

4、重启tomcat

5、新建一个shtml文件测试一下

<HTML>
<HEAD>
<TITLE>shtml测试</TITLE>
</HEAD>
<BODY>
<!–#echo var=”DATE_LOCAL” –>
<!–#include virtual=”hello.jsp”–>
</BODY>
</HTML>

执行ok!!!

Tags:tomcat 如何 才能

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接