EJB and Servlets

Hi,

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

Thank you,

Rocio
arocioAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slokCommented:
For a start, EJB and servlet serves
2 difference purpose.


Quoting from JGuru
http://www.jguru.com/jguru/faq/faqpage.jsp?name=EJB
==
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ravindra76Commented:
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
transparently.

Visit this URL for EJB:_

Excellent in Net:-

http://www.execpc.com/~gopalan/java/ejb.html 

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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.