leonglass
06-22-2008, 02:56 PM
I have been looking around on this subject and the considered advice seems to be that I should not pass a RecordSet to my jsp page as I should close the connection as soon as possible. So I have gone on to try and process the information returned in the recordset and store it in a Vector and pass that to my jsp page for rendering. It doesn't work so my question is how should I be doing this?
...
while(rs.next())
{
users.add(new UserInfo(rs.getInt("uid"), rs.getString("name"), rs.getString("pass"), rs.getString("email")));
...
request.setAttribute("users", users);
}
From within the jsp file I can't seem to get the info back out of the users attribute at all but I have only been trying a for loop with an Enumeration. UserInfo is a class I have defined that just has the relevant constructor and public fields so I can access the members. Should I be looking at Beans for this?
The error I keep getting is "Enumeration cannot be resolved to a type"
for(Enumeration e = ${users}.elements(); e.hasMoreElements();)
...
while(rs.next())
{
users.add(new UserInfo(rs.getInt("uid"), rs.getString("name"), rs.getString("pass"), rs.getString("email")));
...
request.setAttribute("users", users);
}
From within the jsp file I can't seem to get the info back out of the users attribute at all but I have only been trying a for loop with an Enumeration. UserInfo is a class I have defined that just has the relevant constructor and public fields so I can access the members. Should I be looking at Beans for this?
The error I keep getting is "Enumeration cannot be resolved to a type"
for(Enumeration e = ${users}.elements(); e.hasMoreElements();)