Thursday, May 8, 2008

JSP Servlet J2EE Questions 11

51: What is an EJB Context?
A: EJBContext is an interface that is implemented by the container, and it is
also a part of the bean-container contract. Entity beans use a subclass of
EJBContext called EntityContext. Session beans use a subclass called
SessionContext. These EJBContext objects provide the bean class with information
about its container, the client using the bean and the bean itself. They also
provide other functions. See the API docs and the spec for more details.

52: The EJB container implements the EJBHome and EJBObject classes. For every request from a unique client, does the container create a separate instance of the generated EJBHome and EJBObject classes?
A: The EJB container maintains an instance pool. The container uses these
instances for the EJB Home reference irrespective of the client request. While
refering the EJB Object classes the container creates a separate instance for each
client request. The instance pool maintainence is up to the implementation of the
container. If the container provides one, it is available otherwise it is not
mandatory for the provider to implement it. Having said that, yes most of the
container providers implement the pooling functionality to increase the performance
of the application server. The way it is implemented is again up to the
implementer.

53. What is servlet?
Servlets are modules that extend request/response-oriented servers, such as java-enabled web servers. For example, a servlet might be responsible for taking data in an HTML order-entry form and applying the business logic used to update a company’s order database.

54. What are the classes and interfaces for servlets?
There are two packages in servlets and they are javax. servlet and

55. What is the difference between an applet and a servlet?
a) Servlets are to servers what applets are to browsers. b) Applets must have graphical user
interfaces whereas servlets have no graphical user interfaces.

No comments:

Useful Information