commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Rasmussen" <razmas...@gmail.com>
Subject Re: [FileUpload] Passage of values from a servlet to a jsp
Date Wed, 30 Jan 2008 16:38:02 GMT
How does your servlet forward to your JSP?

On Jan 30, 2008 10:33 AM, Matteo Di Palma <dipalma.matteo@gmail.com> 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: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message