Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why tomcat does not require restart when jsp is changed

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.

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.

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

like image 215
Hardik Mishra Avatar asked Mar 13 '12 09:03

Hardik Mishra


People also ask

How to check if tomcat has restarted a service?

You can watch the status of it and other services by running the same "utils service list page" command. When the service has restarted (might take a few minutes), just note the services that are started again. For the most part, if I restart Tomcat for some reason - the first thing I do is attempt to login to an administration web page.

Which JSP engine does Tomcat 8 use?

Show activity on this post. Tomcat 8 and 7 uses the Jasper 2 JSP Engine. One of changes was made in this version is: If you make a change to a JSP page which had already been compiled Jasper 2 can recompile that page in the background.

What happens if I make a change to a JSP page?

If you make a change to a JSP page which had already been compiled Jasper 2 can recompile that page in the background. The previously compiled JSP page will still be available to serve requests. Once the new page has been compiled successfully it will replace the old page.

How do I restart the Cisco Tomcat service in Unity?

For Unity Connection To restart the Cisco Tomcat service, use the CLI command utils service restart Cisco Tomcat.


1 Answers

Because when Tomcat is asked to execute a JSP, is compares the modification date of the JSP file with the modification time of the compiled class corresponding to this JSP, and if more recent, it recompiles on the fly before executing it.

This is BTW an option that should be turned off in production, because it takes time to perform this check.

See http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html for details.

like image 166
JB Nizet Avatar answered Nov 10 '22 22:11

JB Nizet