Say for example when we don't have a servlet initialized during container startup and when we request for a servlet, the container creates a request and response object. I want to know which one is created first, the servlet instance or the request and response instance?? Can anyone comment on this?
The container instantiates a servlet either on startup(if specified) or on first request. So, I think it creates the request, response objects first and then the servlet instance if the servlet if already not loaded.
Well, look. Tomcat is open source. So you could get the source code of Tomcat and answer this question for yourself in the Tomcat context. That's not to say that Websphere or JBoss or any of the other servers do the same thing, though. I think we are all bemused why you care about this question.
My usual question is "What would you do differently based on the answer to this question?" but I try to avoid posting that in the certification forums, where it doesn't apply. However in this case I don't think the question is going to be asked on any certification exam, so perhaps it could be asked.
Paul, I know that this is a silly or rather irrelevant question, but I just wanted to know out of curiosity. Anyways thanks to all the ranchers who participated in this debate. Thanks again!