Hello, I want to know why we need not restart apache/tomcat server if we make a change in jsp file. Just refreshing a browser will reflect my changes. On the other hand if i make a change in servlet(java file) i need to restart tomcat/apache to reflect those changes.
Containers have separate class loader for JSPs and are designed to watch the dates of the files to reload them when they change. This makes editing JSPs as easy as working with scripting languages like PHP, ASP, Perl, etc....
Thanks for reply. Does it mean that separate class loaders are used for servlets and jsps. Container might be running inside one VM having default embedded class loader which is used to load servlet class files,but in case of JSP custom class loaders are used is it what you mean. Moreover it chooses files to recompile based on timestamps. PS: If you can throw some light on what it means by precompilation of jsps.
Not separate JVMs. They all run under the same JVM but there are custom classloaders to make JSPs behave more like scripts.
If you can throw some light on what it means by precompilation of jsps.
As the name implies, it's possible to compile all the of the JSPs in an application ahead of time. There are ups and downs to doing this. Doing so means that each page is already compiled before the first user hits it so the user doesn't experience the slight delay that it takes to compile the JSP to servlet code, compile the servlet to byte code, and load the servlet. When deployed this way, some containers allow you to shut off the checking mechanism (the one that checks the date stamp of each JSP before serving it up) which also speeds things up. From a security standpoint, an app with pre-compiled JSPs doesn't require a compiler. If there is no compiler on the production server, then it is harder for a hacker to get their own code running on that box.
The down side is that you loose the script like convenience of being able to upgrade an app on the fly by editing or replacing a simple JSP file (which is a text file). [ June 04, 2008: Message edited by: Ben Souther ]