Servlets are 'persistent' for as long as the servlet engine wants them to
be, which in my experience means they get loaded once and stay in memory.
However you could also maintain a connection pool as part of a JSP
application - create a bean that has 'Application' scope and use the bean to
manage the connections - in fact I've just done the same thing with a tag
library in JSP.

However efficiency doesn't really come into this - it's more a question of
good design and the ability to maintain (and change) your 'code'. IMO it
comes back to discussions we've had numerous times on this list about
separating logic from layout - keep your HTML in the JSP, put the logic
elsewhere whereever possible,

Kevin

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of berry
Sent: 15 November 1999 13:49
To: [EMAIL PROTECTED]
Subject: Re: JDBC from JSP


I think it is good to partition data access out of a JSP page
from a OO point of view, but how is it any more efficient
getting a connection in a servlet than from a page?

I guess one solution would be to make the servlet persistent
(one instantiation for all requests) and have it maintain
a pool of connections.  Can you make a servlet persistent
in pure web servers like Apache or Netscape?  Most
App servers I have worked with have that feature.

Berry Crawford

----- Original Message -----
From: Karl Roberts <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 15, 1999 5:38 AM
Subject: Re: JDBC from JSP


> Hi Sudha,
>     In my humble opinion Connecting to a Database from a JSP is not such a
good
> idea due to the time taken to connect. However there are many other ways
like
> passing the request ,etc. to a servlet or to an Enterprise Java Bean to
handle the
> Database connectivity.
>
> The J2EE has a programming model that merges these methods and you can
find it at
>
http://developer.javasoft.com/servlet/SessionServlet?url=http://developer.ja
vasoft.com/developer/earlyAccess/j2sdkee/download-docs.html
>
> or go to
> http://developer.java.sun.com/developer/products/j2ee/
>
> hope this helps
>
> Karl
>
> Sudha Gopalakrishnan wrote:
>
> > Hi,
> >
> > Can someone point me to an example where you do
> > database connecctivity from a JSP page. ( Like you use
> > ADOs in ASPs, what is the equivalent in JSPs?)
> >
> > Thanks,
> > sudha
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Bid and sell for free at http://auctions.yahoo.com
> >
> >
===========================================================================
> > 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

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