When does the servlet object gets created ? during deploymen

When does the servlet object gets created ? during deploymen

Postby Padma41 » Fri Feb 08, 2013 8:48 pm

When does the servlet object gets created ? during deployment of an application in the server or when request is being sent to the sever?
Padma41
 
Posts: 6
Joined: Wed Jan 30, 2013 6:23 pm

Re: When does the servlet object gets created ? during deplo

Postby Rose » Sat Feb 09, 2013 2:32 am

My understanding is - when the client makes the request, the web container initialize the Serlvet instance by calling the
inti() method, this is when the Servlet objects gets created.
Deployment is coping of files in appropriate directory.
Rose
 
Posts: 20
Joined: Tue Jan 29, 2013 5:16 am

Re: When does the servlet object gets created ? during deplo

Postby Kishan » Sun Feb 10, 2013 5:47 am

Programmer doesn't have any control when the servlet object being created. But one thing is sure when client sends request container checks for existing servlet object if it is not available it creates object otherwise existing object will serve the request.

As a programmer you can ensure creating servlet object during server startup time by spacifying <load-on-start> element in the web.xml or annotation.
Kishan
 
Posts: 191
Joined: Tue Jan 29, 2013 4:21 am


Return to Servlets

Who is online

Users browsing this forum: No registered users and 1 guest

cron