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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setAttribute to a query result

Status
Not open for further replies.

RicardoPereira

Programmer
Jun 3, 2003
255
PT
Hi,

After login i want to set some attributes in my index.jsp.
The attributes must be the result of a query to my database.
I think i cant put in an attribute the result of an arrayList, even if result only one record.
How do i do that?

Thanks
Ricardo Pereira
 
Code:
ArrayList arr = new ArrayList();

// JDBC stuff
// Loop the ResultSet, building up the line you want to add
// to the ArrayList, then add it as so :
arr.add(myLineToAdd);

// Then outside of the loop
session.setAttribute("myLineToAdd", myLineToAdd);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top