OK, so the first block of code goes in a servlet, then the servlet gets
called into the jsp and then the second block of code gets executed? Why
does the first block need to go in a servlet as opposed to just being
written into the jsp page?
Aaron
<<:::..:::...::: Aaron Prohaska :::..:::...:::>>
VerdeSoft Internet Services
mailto:[EMAIL PROTECTED] http://www.verdesoft.net/
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Joshi, Aparna
Sent: Tuesday, July 18, 2000 12:03 PM
To: [EMAIL PROTECTED]
Subject: Re: [JSP-INTEREST] Storing sessions
Hi Aaron,
Vector of vectors will help you. Each row is a vector. Put this vector in
another vector. put this vector in session. get that vector in jsp and
traverse into the vector and display the whole table.
For example,
followinf code goes IN servlet
import java.util.*; // for vector
Vector table = new Vector();
for (int i = 0; i < number of rows;i++){
Vector row = new Vector(4);
row.addElement(Item);
row.addelement(Description);
row.addElement(Price);
row.addElement(Quantity);
table.addElement(row);
}
session.putValue("Table",table);
in JSP
Vector table = (Vector)session.getValue("Table");
while (table.hasMoreElements()){
Vector row = (Vector)table.NextElement();
String item = row.ElementAt(0);
String description = row.ElementAt(1);
String price = row.ElementAt(2);
String quantity = row.ElementAt(3);
// display
<td><item></td>
<td> description</td>
<td> price </td>
<td> quantity</td>
}
Good luck.
Aparna
-----Original Message-----
From: Aaron Prohaska [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 18, 2000 11:27 AM
To: [EMAIL PROTECTED]
Subject: Storing sessions
Hello all. I am trying to figure out how to store a group of parameters in
session so that I can store multiple groups and print this out into an html
table. What I can't figure out is how to store a group of parameters in the
session object. My group of parameters consists of this: Item, Description,
Price, Quantity, and Total. Now I need to store those five parameters with
difference values for each item that I have. So my html table would look
something like this.
Item Description Price Quantity
Total
8923 some description $80.29 4
$321.16
2983 second product desc $20.50 2
$41.00
I have been thinking about holding this information in an object and then
holding the object in session, but I can't figure out how to a uniqe object
for each product. I also realize that a database would be the best way to do
this, but I can't use a database for this, so session seemed to be the next
best thing.
Also, is there anyway to create multiple uniqe sessions? I seem to remember
that there is a way to do this using ASP/VBScript, but I can't seem to do
this same thing in Java.
thanks,
Aaron
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets