• 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

Translation and compilation happens only once in a JSP

 
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"When you deploy a web app with a JSP, the whole translation and compilation step happens only once in the JSP's life. " What happens when we change the JSP code ?
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is retranslated and recompiled.
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When we change the code of a JSP page, the container can check the changes to the JSP and recompile it. The time interval after which the container checks for changes in the JSP is configurable in the container generally. Like in tomcat if you go under conf directory and open web.xml in it, you can configure the time interval through checkInterval initialization parameter to org.apache.jasper.servlet.JspServlet...
 
Ranch Hand
Posts: 282
Eclipse IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a related question if that's OK.

If you make a change to a servlet, you have to redeploy your web application for the changes to take effect. If you make a change to a JSP, you don't need to redeploy. However, JSPs are servlets, so why do they differ in this way? Why do you have to redeploy your app when you make a change to a servlet, but don't have to redeploy your app when you make a change to a JSP?
 
Rohan kanade
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because , the .jsp extension is handled by the container which has a parser and jsp engine, which looks at the last modified time of the jsp, and it translates and compiles it on the fly.

where as servlets are not handled by the container in that way.
 
Michael Angstadt
Ranch Hand
Posts: 282
Eclipse IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I was just wondering why it can't do the same thing with servlet .class files. Like, check to see if the class file was updated when the servlet is called and reload it if it was. It probably has something to do with the servlets being in the classpath and not being files like JSPs or something.
 
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
Some containers, such as Tomcat, have an option to reload the web app if a servlet changes. But monitoring the classpath is expensive, so it's only recommended for development systems and not production.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic