AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

outputstream e tabelle

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian)
View previous topic :: View next topic  
Author Message
emma ronco
Guest





PostPosted: Thu Aug 26, 2004 9:13 am    Post subject: outputstream e tabelle Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.