Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP's compiled servlets  RSS feed

 
Alfred Kemety
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that JSPs are translated into servlets and then the servlets are compiled into classes and run. This happens - I guess - the first time the JSP page is requested by a client browser.
My questions are:
1- Does the compiled classes get saved on the HDD? or does it stay in memory?
2- On web server stop and re-start, does the JSP files get retranslated and recompiled to classes? or does a copy of the compiled classes still exist somewhere on the HDD?
I ask so because in .NET aspx files and .cs files gets compiled to DLLs and saved on the HDD, IIS can stop and restart without this affecting the DLL files, so aspx and cs files doesn't have to be recompiled, which I guess is good for the performance.
Thanks in advance,
 
Praful Thakare
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alfred
abt ur first query,
The compiled class dose get stored on HDD
in case of tomcat server u will find it in works folder,say u have an jsp called Calculator.jsp in say MyApps
so u will find Calculator_jsp.java and Calculator_jsp.class in
jakarta-tomcat.../work/standalone/localhost/MyApps/Jsp folder.
and abt 2nd query
i guess restarting of server dosent regenerate the class file but it happens if the jsp file is yonger to class file
cheers
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect that depends on the particular JSP engine - Tomcat 4.1.24 appears to save them in the /work directory.
Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This happens - I guess - the first time the JSP page is requested by a client browser.

Correct. It will also be re-translated if the container detects that the JSP file has been replaced with a newer one (one with a more recent timestamp).

1- Does the compiled classes get saved on the HDD? or does it stay in memory?

Both the java source file and the class file resulting from its compilation are written to disk. Exactly where is dependant upon the servlet container.
In fact, perusing the generated java file is great debugging technique for your JSPs when they're not doing exactly what you expected, or just a good way of understand how JSPs work.

2- On web server stop and re-start, does the JSP files get retranslated and recompiled to classes?

All the containers that I'm familiar with seem to be smart enough not to perform re-translation unless something has changed between server stop and start. There may also be configuration settings that might affect this. I suspect the details are highly dependent upon the servlet container you are using.
hth,
bear
[ May 02, 2003: Message edited by: Bear Bibeault ]
 
Joe Broderick
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I never considered to look for the resulting file from a compiled jsp. I just thought jasper held it in memory. Looking for the class and java file is a great idea for debuging. Thanks! It pays off to read all the threads.
 
Alfred Kemety
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all for the replies, I know better now.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!