Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

best way to return a result set from java bean to jsp

Status
Not open for further replies.

gwu

MIS
Dec 18, 2002
239
US
I am new to JSP and I would like to know what the best way to send the mysql result set back to the jsp page from the java bean; vector, multidimensional array, or even comma-delimited string?

Lets say:

"select firstName, lastName, emailAddress from user"

Furthermore , I will not know how many rows will be returned, 1, 50, or even 10000.

Thanks
 
Personally, I favour an ArrayList of HashMap's.
 
Nicer is to have a java class called User and you create for every row in the resultset a user object and put those in a collection. Then get the collection and display them on the jsp page.

sjakie

----------
Yes, the world is full of strange people.
 
I use the same apprach as sjakiePP. Your code will be a lot more maintainable and function in a variety of situations.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top