为什么在不重新启动Tomcat的情况下无法反映我的JSP更改? [英] Why are my JSP changes are not reflected without restarting Tomcat?
问题描述
我正在编辑直接位于tomcat/webapps/myapp/WEB-INF
内部的JSP文件,但是要查看更改,我必须重新启动服务器.据我所知,JSP更改不需要您重新启动服务器.我发现与自动重新加载相关的唯一配置是 reloadable ="true"
I am editing JSP files which are residing directly inside tomcat/webapps/myapp/WEB-INF
, but to see the changes, I have to restart the server. As far as I know, JSP changes don't require you to restart the server. The only configuration I found which is related to automatic reloading is reloadable = "true"
如果要让Catalina设置为true 监视/WEB-INF/classes/中的类 和/WEB-INF/lib进行更改,以及 自动重新加载网页 如果检测到更改,则应用程序.
Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected.
我在context.xml
中使用了此属性,但是问题仍然存在.不重新启动就无法检测到JSP文件更改的其他可能原因是什么?
I used this attribute in the context.xml
, but still the problem persists. What could be the other possible reason of not detecting changes in JSP files without restarting?
@Bozho:
这是来自web.xml
的摘录.我需要更改一些东西吗?
@Bozho:
This is the excerpt from web.xml
. Do I need to change something?
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
推荐答案
在tomcat文档中,请参见development
设置.必须将其设置为true才能重新加载jsps.
In the tomcat docs, see the development
setting. It must be set to true in order to have jsps reloaded.
开发-Jasper是否在开发模式下使用?如果为true,则可以通过ModifyTestInterval参数指定检查JSP的频率.true或false,默认为true.
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 or false, default true.
这是在您的CATALINA_HOME/conf/web.xml
此外,如果需要在生产环境中刷新jsp而无需重新启动,则可以转到CATALINA_HOME/work/Catalina/localhost/contentName/org/apache/jsp
并删除your_jsp.java
和your_jsp.class
文件.下次访问它们时将重新创建它们.
Additionally, if you need to refresh a jsp in a production environment without restart, you can go to CATALINA_HOME/work/Catalina/localhost/contentName/org/apache/jsp
and delete the your_jsp.java
and your_jsp.class
files. They will be recreated the next time they are accessed.
在提供您的配置并评论不刷新内容后,我还有另一个建议:清除浏览器缓存,或从其他浏览器打开页面.
after providing your configuration, and comment about not refreshing the content, I have another though: clear your browser cache, or open the page from another browser.
这篇关于为什么在不重新启动Tomcat的情况下无法反映我的JSP更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!