> >From: Andrew Bruno <[EMAIL PROTECTED]>
> >Reply-To: A mailing list about Java Server Pages specification and
> >reference <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: RECORDSET TO array OR VECTOR
> >Date: Wed, 5 Sep 2001 14:36:09 +1000
> >
> >Hello,
> >
> >I was wondering if anyone knows of any docs, or can give
> some ideas of
> >the best way to convert a recordset into an array or vector
> so that the
> >data may be referenced many times, even though the
> connection is closed.

//make each individual resultset a vector tmp_vct1 and put it into another
vector tmp_vct2

Vector tmp_vct2 = new Vector();
while(res.next){
        Vector tmp_vct1 = new Vector();
        tmp_vct1.addElement(1) = res.getString('column name or index')
        ...
        tmp_vct1.addElement(n) = res.getLong('column name or index')
      tmp_vct2.addElement(tmp_vct1);
}

//when extracting the results later...
for(int i=0; i<tmp_vct.size();i++){
        Vector tmp_vct3 = (Vector)tmp_vct1.elementAt(i)
        out.println((String)tmp_vct3.elementAt(1));
        out.println((Long)tmp_vct3.elementAt(1));
}

There might be better ways to do this such as using the Map object but I
havn't used it.

Glenn


> >
> >ON a side note, does anyone have information on storing data into
> >javascript arrays, so that there is no need to do a server
> request. i.e.
> >from server side recordset to javascript array, but this is not that
> >important yet.
> >
> >Thanks, Andrew
> >
> >=============================================================
> =============To
> >unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> >JSP-INTEREST".
> >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> >DIGEST".
> >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
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
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".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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

Reply via email to