El_gringo | 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 :
- // Method of a "Page" class
- public void write (OutputStream out) {
- // Reading of the tiff file (this.tempFile is a valid File)
- PlanarImage image = JAI.create("fileload", this.tempFile.getCanonicalPath ());
- /* // Test : the writed file is a valid tiff file --> the reading is OK !
- * File outFile = new File ("c:\\temp\\JLdsWeb\\Test.tif" );
- * RenderedOp op = JAI.create("filestore", image, outFile.getCanonicalPath (), "tiff" );
- */
- // Writing of the tiff file in the received OutputStream
- JAI.create("encode", image, out, this.FORMAT_NAME, null);
- }
- // my 1st JSP :page.jsp (to call the 2nd JSP witch have an other content type)
- <%@page
- contentType="text/html"
- language="java"
- errorPage="errorpage.jsp"
- import="com.damaris.ldsweb.*,com.damaris.data.*,com.damaris.page.*,java.util.*"
- %>
- <html>
- <head></head>
- <body>
- <IMG src=<%=request.getContextPath()%>image.jsp>
- </body>
- </html>
- // my 2nd JSP
- <%@page
- language="java"
- errorPage="errorpage.jsp"
- import="com.damaris.ldsweb.*,com.damaris.data.*,com.damaris.page.*,java.util.*"
- %>
- <html>
- <head>
- <%
- // pageToPrint is an instance of the class "Page" (getContentType ( ) give the String "image/tiff" )
- response.setContentType(pageToPrint.getContentType ( ));
- %>
- </head>
- <body>
- <%
- ServletOutputStream bOut = response.getOutputStream();
- pageToPrint.write (bOut);
- %>
- </body>
- </html>
|
Message édité par El_gringo le 17-07-2002 à 12:43:23
|