• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 373
  • Last Modified:

EJB and Servlets


What's the difference between an EJB and a Servlet ??

Thank you,

1 Solution
For a start, EJB and servlet serves
2 difference purpose.

Quoting from JGuru
Enterprise JavaBeans (EJB) is a server-side component architecture for the development and deployment of distributed object systems for the Java platform. Applications written using the EJB architecture are scalable, transactional, and multi-user secure

whereas for servlet, it is more like
CGI but with the advantages of Java as
a language and also consuming less
resources than CGI as it does not
spawn an entire new process upon request.

Servlets role will be more for handling
inputs from the web browser and
potentially it can pass it on to JavaBeans or even EJB to process.
Enterprise JavaBeansTM (EJB) technology is a framework for developing and executing distributed applications. These
applications require system-level services, such as transaction management, security, client connectivity, and database access.
Enterprise JavaBeans technology provides these services, allowing you to focus on the business logic in your applications, not
the system-level plumbing. You code the business logic in enterprise beans, reusable components that can be accessed by client
programs. Enterprise beans run on an EJB server, which functions as a middle-tier server in a 3-tier client/server system.

Benefits of Middle-Tier Servers

A middle-tier server plays a vital role in a 3-tier application. It handles requests from clients, shielding them from the complexity
involved in dealing with back office systems and databases. The middle-tier server might support a variety of clients, such as
web browsers, Java applications, and hand held devices. The clients handle the user interface. They do not query databases,
execute complex business rules, or connect to legacy applications. They let the middle-tier server do these jobs for them

Visit this URL for EJB:_

Excellent in Net:-


All Ur doubts will be clarified.

Servlets will eliminate CGI drawbacks of seperate prcoess , unable to contact with webserver variablets etc.

EJB uses RMI and it will be used as middle tier in Enterprize apps

Best of luck

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now