The purpose of the Tomcat work directory is to compile the JSP files in each project as Java files if the project does not have a JSP page then the project folder is empty

Source: Internet
Author: User

Recently found that many users like the Tomcat work directory in the things called cache, in fact, it is not very appropriate, working directory is only Tomcat directory, that is, Tomcat to convert the JSP to a class file working directory,   That's why it's called the work directory, not the cache directory. Jsp,tomcat works by when a browser accesses a JSP page, Tomcat translates the JSP page into a. java file in the work directory, such as converting index.jsp to a Index_jsp.java file, and then compiling the Index_ Jsp.class file, the last Tomcat container loads the Index_jsp.class class into memory through the ClassLoader class to respond to the client's work.
Tomcat periodically strokes the JSP files in the container, reads the properties of each file, and when a JSP file is found to be changed (the last modification time of the file is not the same as the last stroke), Tomcat will re-convert and compile the JSP file. But Tomcat's stroke is timed and not real-time, which is why JSP files can take a few minutes to change and wait for the modified JSP to take effect. Of course, in order to take effect immediately, many old-timers would recommend clearing the files in the work directory immediately after modifying the JSP page.
In addition, in the Tomcat container, the converted Java files (for example: index_ Jsp.java) Compile maximum support only 64k, so in other containers in the JSP porting to the Tomcat container will encounter a large JSP file can not compile, it is recommended that the business logic in the JSP to write a separate class, in the JSP by invoking the static method of the class to execute, and the JSP page JS extract And put it in a separate JS file.
I think it's a good article.

The purpose of the Tomcat work directory is to compile the JSP files in each project as Java files if the project does not have a JSP page then the project folder is empty

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.