--- Nic Ferrier <[EMAIL PROTECTED]> wrote:
> >>> Leau Stefan Costin <[EMAIL PROTECTED]> 14-May-01
> 7:38:48 PM >>>
> > When can you use a servlet and why and when
> > does ejb really helps? Why use ejb and/or servlet?
> > And why should anyone make a jsp instead of a
> > servlet? - the syntax is much different and uglier
> and
> > they basicly do the same thing.
>
>
> First: JSP vs Servlets
>
> JSPs are just an easier way to write servlets.
> They're particularly
> usefull if you're not confident with programming
> languages but you
> still want to have some server side functionality.
>
> They're also usefull if you're a java-pro and you
> just want to do
> something quickly.
>
> Servlets should be used whenever you need to do
> anything complicated.
> Complicated things can be done in JSP (there are no
> limitations) but
> the syntax is messy and there aren't many nice IDEs
> to help you out
> (syntax colouring etc...). Also, it's not usual to
> have the std.
> compile-run sequence with JSPs so compile time bugs
> can be a bit of a
> pain with complex code.
>
>
> EJBs vs Servlets:
>
> This is probably off-topic. But I think it's
> important to discuss...
> I wouldn't dream of voicing these opinions on
> EJB-interest so here
> seems as good a place as any.
>
> This is an opinion which is going to cause some
> debate... so here
> goes. EJBs are similar  to JSPs in that they are a
> qucik and dirty way
> of doing something quite complex, in this case,
> writing business logic
> for enterprise apps.
>
> Ideally, the EJB container provides everything the
> programmer has to
> worry about:
>
> - serialization of data
> - choice of database
> - access to resources
> - transactional control
>
> This is tremendously usefull because it means you
> can just get on
> with doing the job at hand and not worry about all
> the troublesome
> (and complex) things that go on in the background.
>
> In comparison a servlet just provides the means to
> plug some logic
> into an HTTP service. Nothing else is provided
> (well, maybe session
> data persistence if the container is so inclined).
>
>
> But there's nothing that can be done with EJBs that
> can't be done by
> hand inside a servlet. And for some applications
> hand coding is
> better.
>
> Here's an example: I'm working on a web based
> financial accounts
> system (primarily for use at my own company).
> There's a SQL backend
> (of course) which stores all the records of
> financial transactions.
> I've written some objects to represent some of the
> common
> transactions, for example: invoice, credit note,
> cheque payment,
> etc... This sounds like just the sort of thing that
> I could have
> implemented with EJB but I chose not to.
>
> Why? Because EJB doesn't allow me to optimize the
> database
> transactions. An entity bean represents one entity
> in the database and
> has a SQL query that represents that 1:1 binding.
> But in my accounting
> system it is sometimes more efficient to pre-fetch
> all the entities of
> a particular type (eg: all invoices) and to do that
> using particular
> query constraints (eg: all invoices where the
> supplier is called
> "Sun"). EJB cannot represent that kind of
> relationship (not without
> breaking the model anyway).


Nic, this is really an interesting viewpoints. I agree
with you in that the way you implement your database
design and its transactions should be flexible enough
for your needs and that is best achieved when you
design everything from ground up. But I thought that
was exactly what SUN tried to provide with EJB. Well,
it always good to see things in a new angle. Let's see
what others have to say.

-roy

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to