| hello
2)What is the difference between Webcontainer and ServletContainer.
From a logical point of view, a Servlet/JSP session is similar to an
EJB session. Using a session, in fact, a client can connect to a server
and maintain his state.
But, is important to understand, that the session is maintained in different ways and, in theory, for different scopes.
A session in a Servlet,
is maintained by the Servlet Container through the HttpSession object,
that is acquired through the request object. You cannot really
instantiate a new HttpSession object, and it doesn't contains any
business logic, but is more of a place where to store objects.
A session in EJB is
maintained using the SessionBeans. You design beans that can contain
business logic, and that can be used by the clients. You have two
different session beans: Stateful and Stateless. The first one is
somehow connected with a single client. It maintains the state for that
client, can be used only by that client and when the client "dies" then
the session bean is "lost".
A Stateless Session Bean
doesn't maintain any state and there is no guarantee that the same
client will use the same stateless bean, even for two calls one after
the other. The lifecycle of a Stateless Session EJB is slightly
different from the one of a Stateful Session EJB. Is EJB Container's
responsability to take care of knowing exactly how to track each
session and redirect the request from a client to the correct instance
of a Session Bean. The way this is done is vendor dependant, and is
part of the contract.
or it can also be put as Typically, a Web server refers to an execution infrastructure that
handles HTTP requests and responses; a servlet container refers to a
component that handles the lifecycle for servlets; an application
server refers to a framework (servlet container, EJB container, JSP
engine, MQ container, etc.) for handling Web applications. However, a
Web container has a couple of meanings depending on the source. Most
refer to a Web container as the part of an application server that
manages servlets, JavaServer Pages (JSP) files, and other Web-tier
components. Some refer to a Web container as the infrastructure for
managing the lifecycle for Web services. |