Val,

I meant regular beans, not EJBs. Java beans are Java classes that adhere
to certain naming conventions. But you'll have to do your homework on
that....;)

Jim's comments and mine about a Java beans layer on top of the database
said essentially the same thing, but in a different way.

Cheers,
Boris

____________________________________________
Borislav Iordanov
Chief Architect
TICL - a RAD toolkit for server-side Java
http://www.kobrix.com

> -----Original Message-----
> From: A mailing list about Java Server Pages specification and
reference
> [mailto:JSP-INTEREST@;JAVA.SUN.COM] On Behalf Of rvt
> Sent: Friday, October 18, 2002 2:29 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Database Access Using Tags
> 
> Thank you, everyone who replied.
> 
> Just one clarification:  Boris, did you mean EJBs when you said "Java
> Beans"?  I would rather not use EJBs.  I'm only using a Web container,
not
> an application server.  Also, if what you're referring to are just
regular
> beans, would they be in a package?  I know that is probably a stupid
> question, but I have never used beans before, and two developers I've
> spoken
> to in the past have warned me away from EJBs, so when I was planning
this
> particular project, I was not even considering EJBs.
> 
> Jim's suggestion that I package classes and access the methods from
the
> JSPs
> sounded like a nice, simple, clean way to do things.  His caveat was
that
> it
> should be used with caution, and for simple applications.  If an
> application
> were not so simple (and right now, the one I'm working on is), would
Java
> Beans then be the better alternative, if I were able to acquire the
> knowledge I needed to use them?
> 
> By the way, I read that Taglibs are the next evolution from Java Beans
and
> that it is better to use them, in a posting on a user list.  I belong
to a
> number of them, and I can't say which one it was.  But perhaps my
> paraphrasing of what was said there is inaccurate.  I did, however,
get an
> impression from reading it that Tag libraries make using beans
obsolete,
> though that might not have been the author's intent.  I guess that's
how
> rumours get started.  ;-)
> 
> I do really appreciate all the knowledge that is being shared on these
> lists.  I'd be lost without them, and it sure helps to have such
> misconceptions cleared up.
> 
> Val
> 
> ----- Original Message -----
> From: "Borislav Iordanov" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, October 18, 2002 12:20 PM
> Subject: Re: Database Access Using Tags
> 
> 
> Val,
> 
> >
> > I seem to recall reading on one of the user lists (maybe this one)
> that
> > using taglibs for connecting to the database was not a good idea,
for
> > security reasons.  The consensus was that it was at least better
than
> > embedding Java scrptlets in your JSP.
> >
> 
> The main reason accessing a database through tags is better than Java
> scriptlets is that the code is simpler and cleaner. From an
> architecture/design point of view, both approaches can be considered
> equivalent.
> 
> The main reason NOT to access a database in the JSPs is separating
> business logic from presentation, given that you consider JSPs as
> presentation only technology (strange as it may seem, not everybody
> does!). And Model 2 is one approach to that, the most popular one, but
> not necessarily the best.
> 
> > My question/plea for input here is regarding what I should be using
to
> > write
> > the actual connection in.  If tags are not recommended, then should
I
> be
> > using a class, a bean, or a servlet to do that work?  I read
recently
> > (I've
> > been doing a LOT of reading) that tags are a replacement for
> beans--though
> > that sort of conflicts with the point that I read before that tags
are
> > only
> > one step up from using scriptlets.  I'm starting to conclude that I
> should
> > be using a servlet, but I would really appreciate some confirmation
> from
> > people who are experienced with all this.
> >
> 
> First, tags are not a replacement for beans, I wonder where you read
> that ;) Tags are means for providing abstractions/encapsulating
> functionality, be it business logic or presentation related, that is
> accessible through an XML-based syntax in a JSP page. That's pretty
much
> all tags are.
> 
> If you want to separate presentation from the business logic, the
first
> thing you should do is encapsulate the business logic in Java beans.
> Those Java beans will work with the database to
> access/store/update/delete data. And the JSPs will use those Java
beans
> to get the information to display.
> 
> When it comes to getting input from the end-user and storing it in the
> database, you will need to somehow set the bean properties from a
> submitted HTML form and tell the bean to write its information to the
> database (e.g. something like mybean.insert() or mybean.update).
Again,
> the Java bean deals with database access and your presentation layer
> deals only with the Java bean. Most JSP/Servlets frameworks map
> submitted form fields to bean properties automatically. Struts (the
most
> popular Model 2 framework) does that, even though it limits the types
of
> your bean properties to primitive Java types. Our product TICL does it
> also.
> 
> All this is pretty much standard practice...
> 
> >
> > Also, is it possible/necessary to try to make the structure of the
Web
> > application object oriented?  If I'm using JSP, does that negate the
> need
> > for creating an object oriented design--does it make that kind of a
> > design,
> > even though I'm using Java, impossible to really do?
> >
> 
> It is possible and good practice to have your web application be
> object-oriented. However, JSPs make that very difficult, because they
> can't be sub-classed. By encapsulating the business logic of your
> application in Java beans, you have at least that be object-oriented.
> The presentation logic can be made object-oriented, or close to, by ßÜ
sng
> one of the available UI frameworks.
> 
> Cheers,
> Boris
> 
>
========================================================================
==
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-
> INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
> 
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to