• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Translation and compilation happens only once in a JSP

 
jose chiramal
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • 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 ?
 
Rohan kanade
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is retranslated and recompiled.
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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...
 
Michael Angstadt
Ranch Hand
Posts: 277
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • 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
  • 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: 277
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64994
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic