>> My question is when I should use servlet and when EJB?
This is a really good question that many people are asking, and many folks
would advocate not using EJB but using servlets/JDBC for everything.
What does EJB buy you, well you get transactions, but probably not
distributed transactions unless you are prepared to pay large sums of money
for app-servers that support them. Local transactions are easily doable
using JDBC, so if you only want local transactions then you can use JDBC
directly.
You also get an OO programming model with EJB. Whether this is good or bad
in a distributed environment is debatable, especially where performance is
generally the major factor. If you use the EJB model of
client->SessionBean->EntityBean then you need to be very careful
performance-wise (you have a thing, (session) on a thing, (entity) talking
to a database) modulo caching. With servlets/JDBC you have a thing
(servlets) talking JDBC to the database. A thing on a thing is nearly always
slower than a thing.
Many on this list will argue that you should go client to session to JDBC,
which in many cases is a better model, similar in fact to the client to
servlet to JDBC model.
The one advantage you get in using session beans over servlets is that you
program against an interface, which is generally easier to maintain and
manage, than just sending http requests.
The major advantage of servlets over sessions (IMHO) is that you are using
HTTP (the most used protocol on the net modulo POP3/SMTP) over port 80 which
will get you over most proxy/firewall issues.
I'm sure many on this list will offer other advice,
Kevin Jones
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Yong Hu
Sent: 17 December 1999 04:11
To: [EMAIL PROTECTED]
Subject: when using EJB?
All,
I am a newer in EJB,but has use Servlet for a long time.I think
Servlet is good.However,SUN will make EJB as the main application
of WEB computing.I feel EJB is more difficult than servelet and want
to know what is the best aspect comparing to servelt. I thind servlet
can implement all things that EJB can do. But I thind my idea is not
very right. My question is when I should use servlet and when EJB?
Thanks in advance.
Huyong
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".