• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Automatic Compilation

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
This. Exactly this. This is what my therapist has been talking about. And now with a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic