This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Servlet Lifecycle Doubt?  RSS feed

 
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranchers,

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?
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Am I right, ranchers?

Thanks and regards,
Saurabh
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone to support Saurabh?? Any convincing answers for me???
 
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think a more interesting question to ask would be: does it matter whether request/response or servlet are initialized first?
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So does it really matter ulf?
 
Ulf Dittmer
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you are the one preparing for the SCWCD (I assume)

Does it matter? If so, why? If not, why not?
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bemused. I just wanted to know this out of curiosity...which instance is created first...the request/response or the servlet instance?
 
Sheriff
Posts: 23867
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!