问题
While we modify a user-defined Servlet class, we need to Restart the Apache Tomcat Server. but Whenever we modify a JSP file, we need NOT Restart.
Please anyone tell me the exact reason behind that..
Thanks in advance.
回答1:
It's because Tomcat doesn't support hot code replacement. If you're developing in an IDE like Eclipse, then you could use among others the JRebel plugin to achieve this. As of now (May 2019), JRebel has still no free alternatives (primarily because this is really non-trivial).
There are however servers which support hot code replacement out the box, such as WildFly and Payara. For them JRebel is not needed when you edit existing methods. These servers are out the box capable of performing hot code replacement via JVM hot-swap feature. JRebel is then only needed when you want to add new classes/methods and get them to deploy instantly.
来源:https://stackoverflow.com/questions/8428214/why-do-we-need-to-restart-tomcat-every-time-we-edit-a-servlet-class