• Post Reply Bookmark Topic Watch Topic
  • New Topic

Automatic Compilation

 
Sanath Ramesh kumar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i make some changes to the java content of my jsp (i.e,scriptlet), why do these changes reflect directly eventhough a JSP internally converts to a servlet??where as when changes are made to servlet they must be compiled manually to reflect the changes that have been made?
 
Guy deLyonesse
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because a .jsp is not converted to a servlet internally in the way you might think. A .jsp page is compiled on the fly the first time it's requested, and relies on an actual servlet to be able to run. A true servlet is already compiled when it's installed.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That doesn't really answer the question.

After the changed JSP is translated into a servlet, that servlet is compiled and the resulting class is re-loaded, replacing the previously loaded class for that JSP's servlet. The reason that this is possible is because the containers use a special class-loader for re-loadng the JSP-generated servlet classes. Regular servlets use a "normal" class loader that doesn't reload classes on-the-fly.
 
Sanath Ramesh kumar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Bear Bibeault

According to you, every time I make changes to a .jsp file ,it would convert to a servlet.r8??Can i take this as granted??
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sanath Ramesh kumar wrote:every time I make changes to a .jsp file ,it would convert to a servlet.r8?

I don't know what a servlet.r8 is.

Every time the container detects that the JSP has been updated it will go through the translation an compilation process. See this article.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!