Prasanna:
you need to convert some objects in your servlet into a bean (i.e., the term
"bean" as defined in JSP 0.92 specs). the database connection object must
be on that bean and it will be instantiated in that bean...the bean objects
will become accessible when the bean is created in the <usebean>..</usebean>
tags.
there might be some changes on how/when the db connection is
instantiated...in your case it might be more appropriate to create a pool of
connections shared among beans...a sample implementation can be found at:
http://webdevelopersjournal.com/columns/connection_pool.html
'hope this helps!
dexter
-----Original Message-----
From: S. N. Prasanna <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Thursday, February 25, 1999 7:58 AM
Subject: Database access in JSP
>Hi All,
>
> I am quite new to JSP. In my application I have to display a HTML FORM
>with values from Database as default FORM fields. I am loading this FORM
>from the Servlet. Earlier I was generating this form dynamically using
>println() and inserting values from Database at appropriate places. Now I
>want to use JSP to do this.
>
> The problem here is, I am using a centralised DB Object which handles
all
>the Database related stuff. It connects to DB in init() method of the
>Servlet and stays connected as long as the Servlet exists. If I want to
>insert values from DB directly using JSP, then I have to use DB SELECT Bean
>which connects to DB independent of above mentioned Object, which I feel is
>an over head. The only other method I can think of is calling
>sendRedirect(URL) method from the Servlet with FORM field values as
>arguments along with URL and fetching them inside JSP using getParameter()
>method.
>
> Is there any other method to achieve this?. I can see a problem in above
>solution, If I want to send Strings with white spaces/blanks in between,
>then I will get an error as browser cannot resolve the address.
>
>Thanks in advance
>Prasanna
>[EMAIL PROTECTED]
>
> Is there any way by which I can use Objects from servlets directly in my
>JSP.?
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JSP-INTEREST". For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
>
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".