Image Problem, please help

I have posted another topic on the JSP forum. The link to the issue is http://forum.java.sun.com/thread.jsp?forum=45&thread=149894

I have copied the code to help you look at it. I have a servlet which retreives the connection and resultset. I'm trying to return a Blob as a picture (jpeg) back to the calling page.Any help would be greatly appreciated... I have tried a lot of options, so this is just the final (last saved) version...

Thanks in advance...

package lmmfcd.images;

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import java.sql.*;

import oracle.sql.*;

import javax.servlet.jsp.*;

publicclass getImagesextends HttpServlet

{

publicvoid doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException

{

//Grabs and assigns the PageContext

JspFactory _jspxFactory =null;

PageContext pageContext =null;

_jspxFactory = JspFactory.getDefaultFactory();

pageContext = _jspxFactory.getPageContext(this, request, response,

"", true, 8192,true);

//End of the PageContext Stuff

Connection conn = (Connection)pageContext.findAttribute("conn");

ResultSet rset = (ResultSet)pageContext.findAttribute("Image");

if (rset !=null)

{

try

{

BLOB blob =null;

blob = (BLOB)rset.getObject("image");

response.setContentType("image/jpeg");

InputStream in = rset.getBinaryStream("image");

OutputStream out = response.getOutputStream();

int b;

while ((b = in.read()) != 1)

{

out.write(b);

}

in.close();

out.flush();

out.close();

}

catch(SQLException e)

{

thrownew ServletException("Problem");

}

}

}

}

[3260 byte] By [talon74] at [2007-9-26 1:13:40]
# 1
Can anyone provide assistance, or point me in a direction for me to follow?Thanks.
talon74 at 2007-6-29 0:10:45 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...