Solved

adding object to request attribute

Posted on 2004-10-26
201 Views
Last Modified: 2013-11-23
Can  i add an object to a request attribute.
I want to do (in Servlet)


 ResultSet  rs = stmt.executeQuery("SELECT * FROM userdetails");
 request.setAttribute("viewResult", rs);                 
RequestDispatcher view = request.getRequestDispatcher("jsp/viewUsers.jsp");
  view.forward(request, response);

when i try to fetch the attribute in the JSP using
      ResultSet rs = (ResultSet)request.getAttribute(rs);

i get an error. How can I do this?
0
Question by:jessica04
    2 Comments
     
    LVL 37

    Accepted Solution

    by:
    shouldn't that be
             request.getAttribute("viewResult");
    ?
    0
     
    LVL 37

    Expert Comment

    by:zzynx
    Thanks :)
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT Security CISA, CISSP & CISM Certification

    Master the advanced techniques required to protect network resources from external threats with the IT Cyber Security bundle. Built around industry best-practice guidelines, the IT Cyber Security bundle consists of three in-depth courses.

    Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
    In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
    This video teaches viewers about errors in exception handling.

    857 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now