I have one doubt. Suppose I am running a dynamic web application on my machine. I have modified one of the jsp, and now I am trying to access this jsp from internet browser from application, how does server takes a decesion to compile this jsp???
Once you changed the JSP that is currently running,Container automatically knows(thru some mechanism thats is vendor dependent) and at next request it generates a update servlet file,compiles and execute the updated one.
Joined: Jun 14, 2006
Thank you for replying. Actually I was eager to know how the server understands that its time to recompile the JSP...
Most likely it looks at the last modified date of the JSP file. If that is later than the date on the class file, then it's time to recompile. Tomcat keeps the generated source and class files in the "work" directory.
Actually I thought of the same solution. But then thought of one scenario where it will fail. If I back date my machine and then change a JSP and save it, then JSP timestamp will be older than its class file timestamp.... And this JSP will never be compiled.
Joined: Mar 22, 2005
Well, if you change the date on a machine, other things will stop working, too. CVS, e.g., looks at file timestamps as well. Tomcats JSP implementation does indeed break if you change the clock. But that's hardly a bug, more like a deliberate breakage.