Mistroni Marco wrote:

> hi all,
>         i have a question to pose to the entire list:
> which is the difference between
> - using a Bean in the JSP
> - instantiate directly the java class in the JSP
> ???

There are at least three major differences:

* Using a bean lets you save information in between requests
  (if you put it in the session scope or application scope), while
  instantiating a bean directly makes it a local variable that
  disappears at the end of this request (unless you save it
  someplace).

* The type you declare for a <jsp:useBean> can be an interface --
  it doesn't have to be a class.  Thus, if you have a common
  interface to a Customer, and several possible implementation
  classes that implement it, you can write your JSP page to use
  the common Customer interface and not care what particular
  implementation was used.  When you instantiate your own
  classes, you have to use a real class (in other words, pick the
  specific implementation you want).

* The <jsp:useBean> approach works even if the scripting language
  you use is not Java (there are efforts underway, for example,
  to add support for PHP/PERL/etc. as scripting languages for
  JSP in the Jakarta project at <http://jakarta.apache.org>).

>
> hope that anyone can help me in clarify this doubt
> regards
>         marco
>

Craig McClanahan

===========================================================================
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