• 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

pre compilation of JSP file

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am wondering if a container pre-compile a jsp file then does it avoid initialization and execution of _jspService method on the first request?

Thanks
Layla
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Layla,

The jsp page life cycle is;
1. For the first request , the container translates and compiles the jsp file.
2.The container loads the newly generated servlet class.
3. The container instantiates the servlet and causes the servlets jspInit() method to run.
4. The container creates a new thread to handle the clients request and the servlets _jspService() method is called.

Translation and compilation happens only for the first request.
On subsequent requests, step 4 is executed.

Hope this helps.
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how about <load -on-startup> in the DD?
 
Niteen Patil
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think <load -on-startup> should not disturb the call to jspInit() and _jspService() methods.
 
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that <load-on-startup> causes that the first, the second and the third step are performed during deployment.
Step number 4 is performed during request.

Correct me if I am wrong.
 
Niteen Patil
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lucas Smith you are correct.
If <load-on-startup> is set to a number greater than 0, then the created servlet is initialized on server startup.
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So when you want to precompile JSP, you should modify your DD:

(you can add additional parameter for testing purposes - I observed interesting behaviour):



When I request front.jsp (using logical path) - email value is not reachable, but when I use mapping - everything is OK.
Please, remember that!

 
reply
    Bookmark Topic Watch Topic
  • New Topic