• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q about Servlets (4): when are servlets loaded?

 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In how many occasions will a servlet be loaded:
when the web server starts
after the container detects its class file has chaged
when the user sends a request


Are all these options valid? I think it depends on
the container. For example, I think WebSphere doesn't
allow changes to the class file if the web-application
has been started.

Cheers,

Gian Franco
 
Phani Kumar Sripada
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gian,

It also depends on how you write you Deployment Descriptor. If you specify "load-on-startup" element for a partical servlet in the DD then the servlet will be loaded as per the value that is assigned to this element.

In case if this element is missing in the web.xml then loading of Servlet will be determined by the container. It can happen at the time of container startup or can be delayed until the container determines the servlet is needed to service a request. This implimentaion varies from one container to the other.

Phani.
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Phani,

Do you by any chance know whether such
details can be part of the exam?

Cheers,

Gian Franco
 
Sivasundaram Umapathy
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's better to understand the servlet life cycle and the tasks that are carried out during servlet initialisation. Also the knowledge of load-on-startup element is essential.
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Siva

Cheers,

Gian Franco
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic