tomcat配置(提高运行效率)

tomcat配置(提高运行效率)

在%CATALINA_HOME%/conf/web.xml中有(以tomcat5.0.28为例):

 1 < servlet >
 2          < servlet-name > jsp </ servlet-name >
 3          < servlet-class > org.apache.jasper.servlet.JspServlet </ servlet-class >
 4          < init-param >
 5              < param-name > fork </ param-name >
 6              < param-value > false </ param-value >
 7          </ init-param >
 8          < init-param >
 9              < param-name > xpoweredBy </ param-name >
10              < param-value > false </ param-value >
11          </ init-param >
12          < load-on-startup > 3 </ load-on-startup >
13      </ servlet >

在该段代码中增加:
 1 < servlet >
 2          < servlet-name > jsp </ servlet-name >
 3          < servlet-class > org.apache.jasper.servlet.JspServlet </ servlet-class >
 4          < init-param >
 5              < param-name > fork </ param-name >
 6              < param-value > false </ param-value >
 7          </ init-param >
 8          < init-param >
 9              < param-name > xpoweredBy </ param-name >
10              < param-value > false </ param-value >
11          </ init-param >
12          <!-- 增加的初始化参数 -->
13          < init-param >
14              < param-name > development </ param-name >
15              < param-value > false </ param-value >
16          </ init-param >
17          < load-on-startup > 3 </ load-on-startup >
18      </ servlet >

development参数的说明:
development         Is Jasper used in development mode (will check for JSP modification on every access)?  [true]
该参数默认值为true,即tomcat会对jsp页面的每次访问都检测它是否发生了修改;将该参数设置为false后,也就是说tomcat不以开发模式运行,即不再检测jsp是否发生了修改,这样能提高运行效率。
如果系统运行后,偶尔对某个jsp页面进行了修改,只要删除该jsp页面在%CATALINA_HOME%/work目录中对应的servlet源文件和class文件,再访问该jsp页面后,tomcat(jsp引擎)就会重新编译该jsp文件。

你可能感兴趣的:(tomcat配置(提高运行效率))