今天看了一个帖子,帖子里中提到了“tomcat怎么保证jsp在修改后生效”,最后从评论中得到了答案。这里我自己也整理一下,留用。原文地址:http://tywo45.iteye.com/blog/1768354
JSP页面的最终归宿也是Class(JSP->Servlet->Class),为什么同样是Class,一般情况下(Tomcat server.xml中reloadable=false)修改了JSP后,会生效,而修改了Class文件后,不会生效,而要重启呢?
这是因为Tomcat对JSP进入了侦听,如果有修改,就会重新翻译成Servlet并最终编译成Class文件,替换掉原JSP页面对应的Class文件。Tomcat的内部机制是可以让这种Class文件立即生效的。而普通的Class文件修改后,不能立即生效。
在Tomcat的Conf/web.xml文件中,可以对Tomcat的这种对JSP修改的机制进行修改。
<!-- modificationTestInterval --> <!-- Causes a JSP (and its dependent files) to not --> <!-- be checked for modification during the --> <!-- specified time interval (in seconds) from the --> <!-- last time the JSP was checked for --> <!-- modification. A value of 0 will cause the JSP --> <!-- to be checked on every access. --> <!-- Used in development mode only. [4] -->
在“development”(开发模式)下,可以使用modificationTestInterval来设置Tomcat检查JSP更新的时间间隔,单位为秒,默认4秒
<!-- checkInterval If development is false and checkInterval is --> <!-- greater than zero, background compilations are --> <!-- enabled. checkInterval is the time in seconds --> <!-- between checks to see if a JSP page (and its --> <!-- dependent files) needs to be recompiled. [0] -->
在非“development”模式下,使用checkInterval来设置Tomcat检查JSP更新的时间间隔,单位为秒,默认为不检查。
对于上面提到的“development”模式,也是在web.xml文件中配置的,如下
<!-- development Is Jasper used in development mode? If true, --> <!-- the frequency at which JSPs are checked for --> <!-- modification may be specified via the --> <!-- modificationTestInterval parameter. [true] -->
默认情况下Tomcat使用“development” 模式。
相关推荐
NULL 博文链接:https://japankn.iteye.com/blog/577931
NULL 博文链接:https://zfei.iteye.com/blog/1456385
修改java 不重启tomcat jrebel 4.x
实现tomcat热更新class文件
配置tomcat,使其在修改java源码以及js代码时无需重启tomcat,但是在修改xml文件时需要重新部署tomcat
IntelliJ IDEA修改了mybatis mapper xml后自动热发布 热更新 热部署.zip Mybatis xml文件使用热加载检测不更新怎么办?看我的
jsp(Tomcat)中errorPage不能使用的原因解决方法,Jsp技术文章,JSP系列教程,Jsp.htm.rar
jsp配置+sql配置+tomcat配置jsp配置+sql配置+tomcat配置jsp配置+sql配置+tomcat配置jsp配置+sql配置+tomcat配置jsp配置+sql配置+tomcat配置jsp配置+sql配置+tomcat配置jsp配置+sql配置+tomcat配置jsp配置+sql配置+...
linux系统tomcat自动重启脚本:判断监控 tomcat日志catalina.out超过一定限度 自动重启tomcat
轻松实现tomcat定时重启 首先修改jsp.bat中的两个路径,其中set JAVA_HOME后面是jdk路径,下面是tomcat路径;运行,执行注册。 然后修改tomcat.bat中的ping 127.0.0.1 -n 5(暂停时间) 最后将tomcat.bat添加的计划...
linux定时自动重启TOMCAT,SHELL脚本, 按制定时间启动脚本,并自动查找TOMCAT进程,关闭TOMCAT进程,然后再启动TOMCAT进程,服务器压力过大,或遭受攻击时,TOMCAT集群时自动维护出问题的TOMCAT。
这是一个经过测试(WindowsServer 2008)的Tomcat重启脚本,可以放心使用
以AlibabaCloudView 工具 进行tomcat的一键kill 和 重启
mybatis修改了mapper xml不用重启tomcat,热发布热更新.zip
重启tomcat的cmd命令。把里面的服务名变成你的tomcat服务名即可使用。加到windows任务计划中
重启tomcat,将cmd命令加入到服务器的计划中,定时执行
Windows7下,通过BAT和job,定时重启tomcat的方法
Tomcat+JSP+MySQL经典配置实例
spring 重新动态加载数据库或xml中的bean,可以不用重启tomcat
Linux下定时重启Tomcat 1.写一个shell脚本restart.sh,重新启动tomcat vi restart.sh //是新建文件如果没有该文件