该项目是在Tomcat 8上通过WAR部署的,当我更改page.html时,保存刷新网页后,我看不到更改,只能重新启动服务器。
有什么方法可以解决这个问题,我可以看到更改并且不需要重新启动服务器吗?
通过WAR部署需要重启服务器吗?
我要感谢你的帮助。
最佳答案
如果您将 Web 应用程序部署为包含 HTML 页面、CSS 和 JS 等静态资源的 WAR,我认为您无法在不重新启动容器的情况下更新这些文件,因为这些资源位于 WAR 中。
因此当您更新这些资源时,您需要重新打包您的 WAR,然后 Tomcat 需要这个新的 WAR 并重新启动容器。
请注意,Tomcat 可以在不重启整个服务器的情况下重启容器:
来自 Tomcat Documentation :
Deploying on a running Tomcat server
It is possible to deploy web applications to a running Tomcat server.
If the Host
autoDeploy
attribute is "true", the Host will attempt to deploy and update web applications dynamically, as needed, for example if a new .WAR is dropped into theappBase
. For this to work, the Host needs to have background processing enabled which is the default configuration.
关于java - 在Tomcat上通过war部署源,更改html时必须重启服务器吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52609388/