• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javaranch Mock Exam - Question 35

 
Adrian Muscalu
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations for the new mock exam. You've done a great job.
However, I have this observation regarding the above mentioned question:
35) When a servlet receives an HTTP GET Request for the first time, what methods will be called? (Choose three)
a)processRequest
b)service
c)doPost
d)init
e)doGet
While the correct answers are pretty easy to figure out, I think that the method "init" can't be placed among them. If we have the <load-on-startup>1</load-on-startup> element for that particular servlet defined in deployment descriptor, the "init" method is called way before the GET request.
Is this correct?
Adrian
 
Aleks V. Pascoal
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adrian,
you're correct in this question. If you user <load-on-startup> the method init wil be called when the server is up. Since it is called just once, where the first request arrive it wil not be called.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic