有什么方法可以设置 Tomcat 服务器,以便每当我对 Java 类或 JSP 页面进行更改时,更改在浏览器刷新时可见。
我厌倦了停止和启动 Tomcat。我想像 WAMP 的工作方式一样配置 Tomcat [您可以在浏览器刷新时看到 PHP 代码更改]
最佳答案
如果它是用于开发模式就可以了。不要将它用于生产内容。
您不必重新启动服务器。您可以通过 Tomcat Manager 重新启动应用程序。
您甚至可以直接这样做:http://[hostname]:[port]/manager/reload?path=[/path/to/your/webapp]
或
将您的上下文定义为可重新加载
注意:不建议将元素直接放在 server.xml 文件中 查看 Tomcat 配置指南
对于 java 类:可重载
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. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.
NOTE - The value for this property will be inherited from the reloadable attribute you set on the surrounding Context component, and any value you explicitly set here will be replaced. (http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html)
对于 JSP:开发 ($CATALINA_BASE/conf/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 or false, default true.
希望对你有帮助
关于web-services - 在浏览器刷新时编译 JSP 和 Java - Tomcat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11919804/