• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet ques

 
Walter Vetrivel
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A servlet counts the number of times it has been called using an incrementCount() method. During testing, the developer verifies that the servlet accurately counts the requests from a number of clients. Which of the following BEST explains this fact?
a) The web or application server supports activation and passivation of the servlet.
b) The HttpServlet class is designed to share state data across all its instances.
c) The same servlet instance services all the requests.
d) The servlet doGet( ) method has been marked as synchronized.
 
Danl Thompson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Activation/Passivation is part of the EJB spec, not the JSP/Servlet spec. Answer A is a red herring.
ServletContext is designed to share data across instances, but HttpServlet is not. So B is wrong as well.
Answer C is interesting, and would account for the behavior if the counter were a local variable in the servlet. It sounds like the best answer.
Answer D doesn't account for the behavior.
dan'l

 
Walter Vetrivel
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dan'l,
Walter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic