How does your servlet forward to your JSP?

On Jan 30, 2008 10:33 AM, Matteo Di Palma <[EMAIL PROTECTED]> wrote:

> 1) In the class ImageCRUD.java I have the following code:
> _____________________________________________________________________
> | public ResultSet listImage(){
> | ...
> | ps = conn.prepareStatement("select idImage, Name from images");
> | return ps.executeQuery();
> | ...
> |_}___________________________________________________________________
>
> 2) In the Servlet ImageServlet.java I have the following code:
> _____________________________________________________________________
> | ResultSet rs = ic.listImage();     // ic = new ImageCRUD Object
> | ...
> | request.setAttribute("rs", rs);
> |_____________________________________________________________________
>
> 3) In the JSP ShowImage.jsp I have the following code.
> ______________________________________________________________________
> | <%
> | rs = request.getAttribute("rs");
> | while(rs.next()){
> |    int numColumn = rs.getMetaData().getColumnCount();
> |    for(int i=1; i <= numColumn; i++){
> |    out.println(rs.getObject(i));
> | }
> |}%>
> |______________________________________________________________________
>
>
> I think that rs is null and also I see a blank page.
> Where mistake?
>
> Thanks in advance.
> |
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to