This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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?
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.
Experience and talent are independent of age
Joined: Apr 12, 2006
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?"