when a servlet sends request for first time it uses the
follwing methods
a)init
b)doget()
c)dopost()
d)service

Answers were Sorted based on User's Feedback



when a servlet sends request for first time it uses the follwing methods a)init b)doget() c)do..

Answer / sri

when servlet gets first request, webcontainer loads the class and creates the object for it.
2)Constructor executes
3)webcontainer creates ServletConfig obj for servlet obj
4)init() method executes
5)service() method executes.

Is This Answer Correct ?    11 Yes 0 No

when a servlet sends request for first time it uses the follwing methods a)init b)doget() c)do..

Answer / shaik baji

1)We can load the servlet class in two ways as follows:

a) We can load the servlet class while deploying our
applicaion on the server by using the "<load-on-startup>"
tag in web.xml

Ex: <load-on-startup>any positive integer </load-on-startup>

b) We can load the servlet class when the first request
came to it by the container.

2)Once the class is loaded the container will create the
instance of the servlet and initilize it with the
ServletConfig object by invoking "init(ServletConfig scObj)"

3)Then the container create a thread for the request and
execute the setvice() method.

Is This Answer Correct ?    3 Yes 0 No

when a servlet sends request for first time it uses the follwing methods a)init b)doget() c)do..

Answer / sowmya

A servlet can receive a request or forward the request to
another component in an application.

When a servlet receives a request, if it is already
initialized, then the service() method is called. If not
then its constructor is called and then its init() method.

Is This Answer Correct ?    4 Yes 3 No

when a servlet sends request for first time it uses the follwing methods a)init b)doget() c)do..

Answer / giftleejones

a)init

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

what is difference between requestprocessor and request dispatcher?

2 Answers   Tech Mahindra,


What does n mean in java?

0 Answers  


Define Multiprogramming and Multiprocessing in java.

0 Answers   Akamai Technologies,


Can we sort array in java?

0 Answers  


Do you need to import math in java?

0 Answers  






I have a sorting issue with a Hashmap. My constraint is that I MUST use the Hashmap and work with existing code. I do a database query and place the results in a Hashmap. When I iterate thru the Hashmap, it loses the original alphabetical sorting done by the database. So, my problem is that I must sort the results coming out of the Hashmap which is then placed into another class.

1 Answers  


How to eliminate duplicates from an array?

6 Answers   ABC, AdMod, Adobe, College School Exams Tests, Patni, Wipro,


Why is singleton class used?

0 Answers  


difference between arraylist and linkedlist otherthan performance

2 Answers   L&T,


what is difference between class and object?

43 Answers   College School Exams Tests, HCL,


Explain the pointers in Java?

0 Answers   Aspire,


Can you declare an interface method static?

0 Answers  


Categories