Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Iterating through a ResultSet from JSP session

Iterating through a ResultSet from JSP session
Thread Tools
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Oct 11, 2002, 11:16 AM
 
I'm really stuck with this one.

1. After querying an Oracle database (backend) via a Servlet (in the middle tier), I get an object of type ResultSet.

2. I place that object of type ResultSet in the session.

3. I can verify that such object made it into the session.

4. From a frontend JSP (that shares the above session), I need to display the results of the query.

So far this has been a great challenge...

Can someone provide a code snipplet on this matter? I tried various taglibs without success... I guess the issue is knowing how to iterate through that object. The taglibs that I've seen require you do the query from the presentation layer and I'm trying to avoid that (see 1 above). Thanks in advance.
     
Registered User
Join Date: Jul 2000
Location: Newcastle, Australia
Status: Offline
Reply With Quote
Oct 14, 2002, 08:07 AM
 
You need to enumerate the resultset:

while (ResultSet.next()) {

Use the ResultSet.getXXX (ResultSet.getString, etc) methods to retrieve field info from each ResultSet result.

}
Email me if you're still having trouble, but basically, know what the format of the data you're getting back is, then use the above code to feed the information into some other container/variable.
     
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
Oct 14, 2002, 02:38 PM
 
You should really consider implementing a ValueListHandler (Pattern) from the Core J2EE patterns.
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:54 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2