>I am new to using Servlets and JSP but want to use a Servlet to generate
>a result set and then use JSP to display the information. I can generate the
>result set okay and redirect to a JSP, using
>
>request.setAttribute("rs",rs);
>RequestDispatcher rd = getServletContext().getRequestDispatcher("test.jsp);
>rd.forward(request, response);
>
>but how do I use the result set in the JSP page ? I have tried (naively)
>
><% ResultSet passedrs = getAttribute("rs); %>
You're already 95% there. If you look in the docs you see that getAttribute
returns "Object", so you have to cast it to "ResultSet" since you know
what you are doing :-).
><% ResultSet passedrs = (ResultSet) request.getAttribute("rs); %>
After that you should be able to use passedrds as you would
use ResultSet.
>
>but get an error about it needing to be cast.
>
>I have looked through the archive and found information on how to pass the
>result set but not how to use it.
>
>Can anybody recommend a good book on using Servlets and JSP to create a
>database driven application ?
>
>Any help would be appreciated.
>
>Richard Stedham
>British Aerospace Tel: 0181-942-9661
>Apex Tower, 7 High Street, New Malden Fax: 0181-942-9771
>Surrey KT3 4LH E-Mail: [EMAIL PROTECTED]
>England
>------------------------------------------------------------------------------
-
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST"
.
>FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
Ciao,
Carsten Heyl
Carsten Heyl [EMAIL PROTECTED]
NADS - Solutions on Nets http://www.nads.de/
NADS GmbH http://www.pixelboxx.de/
Hildebrandtstr. 4E Tel.: +49 211 933 02-90
D-40215 Duesseldorf Fax.: +49 211 933 02-93
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html