This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between container and servlet?

 
Sriram Sharma
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Can somebody give me explicit difference between a container and a servlet?
I can uinderstand that container contains the servlet and that container gives static objects like html, jpeg/gifs etc.
But what is the reason that we have container and for what reason we have servlets?
What is it that I can do with servlets as standalone?

Regards,
Sriram
 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

It's good that you understand that the container contains the servlet, but another important job the container does is to parse and serve the servlet's response to the request. Apart from this other important tasks of resource management for the servlet are done by the container. A servlet works in the limits of the container, is operational because of the container and can be accessed because of that. Security implementation might be another task to mention.

A servlet is only the operation that takes place when a particular request is made. This operation performed by the servlet is limited to the request only and relates to nothing external. Whereas there are processes a container has to perform when a request is made, but they may be independent of the request, like mundane.

An analogy could be the container as the OS and the servlet as the application s/w.

Sriram Sharma wrote: What is it that I can do with servlets as standalone?

standalone servlet? I am unaware of this part.

Regards
 
Sriram Sharma
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that info Himanshu...
Anybody with anymore/more elaborate info on this would be great :-)

And yeah... Sorry for my last question in this post.
What I meant was...

"What can we do with a servlet container as a standalone?"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic