Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2165 connectés 

  FORUM HardWare.fr
  Programmation

  [servlet/JSP] afficher des images lues par ma servlet (ou ma JSP)

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[servlet/JSP] afficher des images lues par ma servlet (ou ma JSP)

n°177768
El_gringo
Posté le 17-07-2002 à 12:42:24  profilanswer
 

S'il vous plait, regardez si vous voyez un truc qui cloche, moi j'y arrive pas ! (IE6).
En fait, j'essaye de faire afficher au browser, des images lues par ma servlet.
 

Code :
  1. // Method of a "Page" class
  2. public void write (OutputStream out) {
  3.   // Reading of the tiff file (this.tempFile is a valid File)
  4.   PlanarImage image    = JAI.create("fileload", this.tempFile.getCanonicalPath ());
  5.   /*   // Test : the writed file is a valid tiff file --> the reading is OK !
  6.    *   File outFile = new File ("c:\\temp\\JLdsWeb\\Test.tif" );
  7.    *   RenderedOp op = JAI.create("filestore", image, outFile.getCanonicalPath (), "tiff" );
  8.    */
  9.    // Writing of the tiff file in the received OutputStream
  10.    JAI.create("encode", image, out, this.FORMAT_NAME, null);
  11. }
  12. // my 1st JSP :page.jsp (to call the 2nd JSP witch have an other content type)
  13. <%@page
  14. contentType="text/html"
  15. language="java"
  16. errorPage="errorpage.jsp"
  17. import="com.damaris.ldsweb.*,com.damaris.data.*,com.damaris.page.*,java.util.*"
  18. %>
  19. <html>
  20. <head></head>
  21. <body>
  22. <IMG src=<%=request.getContextPath()%>image.jsp>
  23. </body>
  24. </html>
  25. // my 2nd JSP
  26. <%@page
  27. language="java"
  28. errorPage="errorpage.jsp"
  29. import="com.damaris.ldsweb.*,com.damaris.data.*,com.damaris.page.*,java.util.*"
  30. %>
  31. <html>
  32. <head>
  33. <%
  34.     // pageToPrint is an instance of the class "Page" (getContentType ( ) give the String "image/tiff" )
  35.     response.setContentType(pageToPrint.getContentType ( ));
  36. %>
  37. </head>
  38. <body>
  39. <%
  40.     ServletOutputStream bOut = response.getOutputStream();
  41.     pageToPrint.write (bOut);
  42. %>
  43. </body>
  44. </html>


Message édité par El_gringo le 17-07-2002 à 12:43:23
mood
Publicité
Posté le 17-07-2002 à 12:42:24  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation

  [servlet/JSP] afficher des images lues par ma servlet (ou ma JSP)

 

Sujets relatifs
[C] Afficher une image dans une fenêtre... (OK)[C++ Builder] Comment n afficher ke 2 chiffres apres la virgule(float)
[JAVA] Quel est l'intérêt d'un bean ?? (en association avec les JSP)[Servlet/jsp] récupérer l'URI de base d'une web-app
afficher toutes les images d'un répertoire ?pour afficher une image en XML
[Jsp/Servlet] Problème lors du premier forward depuis ma servlet[PHP] Afficher une note de 1 à 5 : aidez moi à optimiser :(
Plus de sujets relatifs à : [servlet/JSP] afficher des images lues par ma servlet (ou ma JSP)


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR