John,

What is confusing is the concept that, at its most basic level,
JavaBeans are just Java classes that include a no argument constructor.
JavaBean often follow the setXXX, getXXX pattern for methods that set
properties (variables) within the JavaBean. Many JavaBeans also
implement the Serializable interface.

Do not mistake JavaBean for Enterprise Java Beans. They are completely
different concepts. All that the two different kind of beans share is
the name and the intention to be used as components.

The reason to use JavaBeans in JSP is to allow the use of the
jsp:useBean, jsp:setProperty, and jsp:getProperty tags. jsp:useBean does
some clever stuff to figure out if the bean is already stored in the
indicated scope. If it is not, it creates a new bean and stores it in
the scope you want. You could duplicate all the functionality yourself,
but it's nice to let the jsp engine take care of it for you.

Carles

John Wheeler wrote:
>
> Hello,
>
> I've started programming fairly simple web application using a combination
> of JSP, Servlets and normal Java classes, but I have noticed a lot of
> comment about JavaBeans on this list.
>
> Most of the tutorial information that I have seen refers to using Beans as
> UI elements, in a similar way to ActiveX objects. Could anyone explain to me
> the advantages and uses of Beans on the server-side? What are the
> fundamental differences between Beans, and other Java classes, and when
> should one choose one over the other?
>
> Thanks for any information!
>
> John Wheeler.
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to