Tomcat Plugins in Intellij Idea 4.5

xiaoxiao2021-03-06  119

Before you explain the problem, you first introduce the working principle of Tomcat. Everyone knows that JSP can be said to be a simple writing method of servlet. It is still a servlet, just set some servlet objects to the default object, and simplifies the HTML output mode. When running, the corresponding request mechanism and servlet basics Is a truth. Therefore, when a JSP page is requested for the first time, Tomcat (or other container) must first convert JSP to Servlet Class. There are two steps in this, first, call the JSP parser (such as JSPC) to change the JSP file to the Java source file. Second, call the compiler to compile the transformed Java file into class files. These two steps require a large number of CPUs and memory resources, quite slow. This is why JSP is slower. Here is a problem, what is the "first request" mean? In fact, after Tomcat compiles the JSP, it saves .java and .class files to the work directory, when requested a JSP page, it will go to find, if not or before. Java file is more than the .jsp files than the server ( According to the date of the document), you will also recompile if you re-analyze. And Tomcat defaults to not delete the generated .java and .class, even if you stop Tomcat and then start, as long as the JSP file is not updated, it will use the original .class file.

OK, clear the above principles, then what is the problem in the Tomcat plugin in the IDEA? I don't know if you feel that Web-Module is very slow in Idea, at least more than JB. The reason is: Idea will delete all contents of the Work directory when starting Tomcat! So, whether you have run Tomcat, no matter whether your JSP has been compiled. As long as you start Tomcat via IDEA, all your JSP is definitely recompiled as long as you open. There may not be found, but if your home contains multiple references pages or Struts Tile pages, then this process may slow you unbearable. More depressed is that you may have to go through the page you want to debug after you can go through a lot of this process. In addition, Tomcat4.0 that is started with IDEA is unable to use Manager to reload (this question can also be solved), if you modify a class and can't reload change classes, you can only turn off the Tomcat that is currently running, and then Launched, then experience some of the work can we see the effect. If the machine is not good, you may have the urge to move the chair. Ok, say so much, solve the method? Very simple, compile the JAR file in Plugins's Tomcatintegration / LIB to remove the corresponding delete code. The specific code reading process is slightly, and there is time to write. The file is located in http://www.jroller.com/resources/warbaby/tomcatintegration.jar, and then replace the original plugins / tomcatintegration / lib / in. Modified content: 1. Do not delete the contents of the IDEA installation path / system / tomcat temporary directory / Work. 2, do not delete the definition of the original web application, so you can use Tomcat4.0's Manager application.

转载请注明原文地址:https://www.9cbs.com/read-99197.html

New Post(0)