在網站開發過程中,有一個很煩的問題就是每次我們在項目里增加幾行代碼,然后我們企圖在瀏覽器中查看修改后的變化時,卻發現瀏覽器的內容並不變化,於是我們只能通過頻繁的重啟tomcat來獲得最新的效果,其實這么做完全沒必要,我們只需要修改下tomcat目錄下conf文件夾中的context.xml中增加reloadable="true"就可以獲得重啟的效果。
具體修改的配置如下:
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- The contents of this file will be loaded for each web application -->
- <!-- 在此處添加reloadable="true"即可 -->
- -<Context reloadable="true">
- <!-- Default set of monitored resources -->
- <WatchedResource>WEB-INF/web.xml</WatchedResource>
- <!-- Uncomment this to disable session persistence across Tomcat restarts -->
- <!-- <Manager pathname="" /> -->
- <!-- Uncomment this to enable Comet connection tacking (provides events on session expiration as well as webapp lifecycle) -->
- <!-- <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /> -->
- </Context>