Hi...

I will let you know one by one

1. First create a data base connection in our servlet.
2. Create an instance of your java beans in our servlet.
3. Write your database queries in that java beans method and pass this
connection object from  servlet
to that java beans method.
4. Do all your fetching in java-beans and return a vector or an arraylist
which is having all the result set values.
5. Once u get the vector return value , pass that vector value back to the
JSP.

For passing vector return value to a JSP you can use

request.setAttribute("vector_name",vector);

(or)

session.setAttribute("vector_name",vector);(if you want this value to be in
persistance upto the client session)

6. In your JSP just call request.getAttribute("vector_name"), it will return
the vector value.


So here The servlet acts as a controller, This pattern is know MVC(model
View Controller)

model -- java beans component
veiw -- jsp
controller - servlet.


Hope i had cleared your doubts. If you still need some clarifications so
mail me.


regards

S.Karthikeyan









1. Write your Database queries inside a javabeans

-----Original Message-----
From: Ha Duy Thien [mailto:[EMAIL PROTECTED]
Sent: Tue 3/11/2003 6:37 PM
To: [EMAIL PROTECTED]
Cc:
Subject: Can anyone tell me about Design Pattern for JSP Application



Dear JSP gurus,

I am writing an JSP application using Jsp pages, Servlet, JavaBean, and
Oracle database. Until now I haven't decided to use Servlet for all of the
database activities and then forward RecordSet to JSP page to display or
just use partially.

If you use servlet for database activities so how do forward recordset to
jsp page : by using a Vector of JavaBeans or other way? Please tell me ,
because I am very newbie to JSP and I just want to make my application like
others

Does anyone here have that experience, please give me brief information .

Or if you have any ebook about design pattern for jsp , please send me some
pages .

Thanks you very much

Thien

=========================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
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 archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to