 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
emma ronco Guest
|
Posted: Thu Aug 26, 2004 9:13 am Post subject: outputstream e tabelle |
|
|
Buongiorno a tutti; ho un problema da risolvere al più presto. Io stampo a
video delle immagini che sono contenute in un campo OID di un database; me
le stmapa ranquillamente con il seguente metodo:
String searchQuery = "SELECT titolo, alloid FROM allegati WHERE
id_allegato=?";
pss = con.prepareStatement( searchQuery );
pss.setInt( 1, test.readInt(qryname) );
rs = pss.executeQuery();
rs.next();
blob = rs.getBlob( "alloid" );
is = blob.getBinaryStream();
os = response.getOutputStream ();
String filename = rs.getString( "titolo" );
canError = false;
String contentType = getServletContext().getMimeType( filename );
response.setContentType( contentType != null? contentType:
"application/octet-stream" );
response.setHeader( "Content-disposition", "attachment; filename="" +
filename + """);
response.setHeader( "Content-length", "" + blob.length() );
int length = 0;
byte[] buffer = new byte[ 4096 ];
while(( length = is.read( buffer )) != -1 ) {
os.write( buffer, 0, length );
}
os.flush();
Il mio problema sorge dal fatto che ora dovrei mostrare a video l'immagine
con il nome della figura dentro una tabella, all'incirca in questo modo:
<table>
<tr>
<td>nome immagine --> filename </td>
</tr>
<tr>
<td>immagine cioè
int length = 0;
byte[] buffer = new byte[ 4096 ];
while(( length = is.read( buffer )) != -1 ) {
os.write( buffer, 0, length );
}
</td>
</tr>
</table>
Come si fa? Ho provato ad usare anche il PinterWriter
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|