Visualizar BLOB (imagen) a través de JSP
Tengo un código para mostrar una tabla de empleados.
Los datos (nombre, teléfono, foto, etc.) se almacenan en SQLServer y se muestran a través de JSP. Mostrar los datos es correcto, excepto la imagen .jpg (almacenada en la columna IMAGEN = BLOB).
Por cierto, ya tengo la imagen mostrada (vea el código a continuación), pero no sé cómo ubicarla en el área definida en un .css (vea el código a continuación también), ya que la imagen atravesó el resultSet se carga en toda la página en el navegador.
¿Alguien sabe cómo puedo "enmarcar" la imagen?
<%
Connection con = FactoryConnection_SQL_SERVER.getConnection("empCHART");
Statement stSuper = con.createStatement();
Statement stSetor = con.createStatement();
Blob image = null;
byte[] imgData = null;
ResultSet rsSuper = stSuper.executeQuery("SELECT * FROM funChart WHERE dept = 'myDept'");
if (rsSuper.next()) {
image = rsSuper.getBlob(12);
imgData = image.getBytes(1, (int) image.length());
response.setContentType("image/gif");
OutputStream o = response.getOutputStream();
//o.write(imgData); // even here we got the same as below.
//o.flush();
//o.close();
--[...]
<table style="margin: 0px; margin-top: 15px;">
<tr>
<td id="photo">
<img title="<%=rsSuper.getString("empName").trim()%>" src="<%= o.wite(imageData); o.flush(); o.close(); %>" />
</td>
</td>
<td id="empData">
<h3><%=rsSuper.getString("empName")%></h3>
<p><%=rsSuper.getString("Position")%></p>
<p>Id:<br/><%=rsSuper.getString("id")%></p>
<p>Phone:<br/><%=rsSuper.getString("Phone")%></p>
<p>E-Mail:<br/><%=rsSuper.getString("Email")%></p>
</td>
</table>
Y aquí está el fragmento que se supone para enmarcar la imagen:
#photo
{
padding: 0px;
vertical-align: middle;
text-align: center;
width: 170px;
height: 220px;
}
Gracias por adelantado !