为什么在更改jsp时不需要重启tomcat [英] why tomcat does not require restart when jsp is changed

查看:978
本文介绍了为什么在更改jsp时不需要重启tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 JSP,Servlet 。我知道无论何时我们在 Servlet 中更改任何内容,我们都需要重新启动Tomcat Server才能获得更改。在JSP更改的情况下,tomcat不需要重新启动。

I have been using JSP,Servlet for quite sometime. I know that whenever we change anything in Servlet we need to restart Tomcat Server to get the changes. Where as in case of JSP change, tomcat does not require restart.

根据我的知识 JSP 页面被转换只有在编译时才进入 Servlet 。所以,毕竟它的 Servlet .So,如果没有 Tomcat 重启,它是如何工作的。

As per my knowledge JSP page gets converted into Servlet only when compiled. So, after all its a Servlet.So, How does it works without Tomcat restart.

我知道JSP页面在服务器重启等后第一次访问时编译的情况。

I have knowledge of cases when a JSP page gets compiled like on first time access after server restart etc.

推荐答案

因为默认情况下tomcat是在开发模式下启动的,这意味着在检测到更改时会重新编译JSP派生的servlet。这是一个很好的问题,JVM如何加载新类 - 可能是tomcat类加载器配置为这样做。

Because by default tomcat is started in development mode, which means JSP-derived servlets recompiled when a change is detected. It's a good questions how does the JVM load the new class - probably the tomcat classloader is configured to do so.

一些相关的注释:


  • 你可以关闭生产的开发选项

  • 你也可以重新加载servlet - 你必须启动tomcat 调试模式中的JVM。

  • you can turn off the development option for production
  • you can have servlets been reloaded as well - you have to start tomcat with a JVM in debug mode.

这篇关于为什么在更改jsp时不需要重启tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆