Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pass RecordSet to jsp

    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?
    Code:
    ...
    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"
    Code:
    for(Enumeration e = ${users}.elements(); e.hasMoreElements();)
    Last edited by leonglass; 06-22-2008 at 03:46 PM.

  • #2
    Regular Coder brad211987's Avatar
    Join Date
    Sep 2005
    Location
    Ohio
    Posts
    631
    Thanks
    10
    Thanked 50 Times in 50 Posts
    Copy the error stack trace to here so we can look at it. It sounds like you just need to import the java.util.Enumeration package to wherever the error is being thrown. If that is the case, it can be done in the JSP page like this:

    <&#37;@ page import="java.util.Enumeration"%>
    Last edited by brad211987; 06-23-2008 at 12:44 AM.

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by brad211987 View Post
    Copy the error stack trace to here so we can look at it. It sounds like you just need to import the java.util.Enumeration package to wherever the error is being thrown. If that is the case, it can be done in the JSP page like this:

    <%@ page import="java.util.Enumeration"%>
    No tried that and it didn't work but I think I have more or less sorted this out by reading through this sitepoint article. I had a few things wrong but I was pleased that I was trying to build it up in the same manner as the final app in that article. Thanks for your time anyway.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •