• 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

JSP compilation

 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a query.

When we run a jsp page for the first time it takes time to execute as the jsp turns into servlet(that is translation and compilation).Now if do some changes in the jsp and with out restarting the serfer does the same translation and compilation take place.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes.
The container compares the JSP and generated servlet's class file with each request and recompiles the JSP if it is new.

Note: Some containers can be configured to disable this in production environments, for performance and/or security reasons.
 
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
You might be interested in this article.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tomcat will constantly moniter the java server pages deployed in the web-inf directory for changes.

when ever a new page is requested, every time , jsp page will compile to corresponding servlets , a java class file , and dump the output as raw html,

you can change the jsp at run time , but cant change the servlet class at run time , i think, i want to work on this matter ,
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by sreejith sree:
tomcat will constantly moniter the java server pages deployed in the web-inf directory for changes.

when ever a new page is requested, every time , jsp page will compile to corresponding servlets , a java class file , and dump the output as raw html,

you can change the jsp at run time , but cant change the servlet class at run time , i think, i want to work on this matter ,



A few corrections.
There is no "web-inf" directory.
Java is a case sensitive language and that directory is spelled "WEB-INF".
This might sound like nit picking but it throws a lot of beginners off so I point this out whenever I see it.

when ever a new page is requested, every time , jsp page will compile to corresponding servlets , a java class file , and dump the output as raw html,



This is not true.
JSPs are only compiled to servlet code once in the life of the application unless the JSP file has been altered. The output, is not necessarily HTML.

Also, many containers have settings to automatically reload the app if any class files are updated. Tomcat does this with the autoReload attribute of the Context entry. With Tomcat, you can also configure it to watch any file for changes and automatically reload the application. I believe Resin can be configured to watch Java source files and automatically compile them with an app reload when they change.
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic