This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi, I have used Tomcat. Now I use Tomcat4.0 Winnt version. whenever I create a new file for writting itis created in the system32 directory of winnt. I have not tried giving the full path as I wonder if it works. In fact it failed when I tested with Jrun3.0 where the file is created in the default dir. What I want to do is using some Image Api s like JAI,Graphics2D I want to embed an image that is dynamically created into the page, and in the process save it.Here I would like to generate reports in the form of barcharts and pie charts. Now if I create a jpeg image and save it,it goes to the system32 directory.We cannot thus give the HREF to the image in the response. I was able to send an image by seting the content type. But I want also HTML matter to go with it. Prashanth
Hi Prasanth, Just awild guess, while sending image to the page, you must writing the bytes to the stream right? In the process why don't you write the html output also to the stream?
Ram Dhan Yadav (SCJP, SCWCD, SCJA-I, IBM EC(483))
"We are what we repeatedly do. Excellence, then, is not an act, but a habit."
Joined: Feb 20, 2001
True, Images are sent as stream. I use JpegEncoder. But how does the browser recognize the mime type. Naturally I specify the content-type. But that is the header part of what I send. Once an Image/jpeg content is written to output how can an html content be sent. The earlier problem has a solution something like this, may be in a jsp page or servlet out.println("<Img src=\"http://myserver/servlet/ ImageProcessServlet\">"); in this case the contentype set is text/html At the same time in the ImageProcessServlet the contentype returned is Image/jpeg. Hence it works. What I wanted to know was if it was possible to write to the html documents folder or where http protocol could access I could directly place the tag href="filename". May be it has been eliminated because of security reasons. But I felt the problem more pushing when I could not save the file uploaded as multipart to the http folder. Take this case. A client uploads an image at a portal. If the image is in the default folder then I must write another servlet like the one above to read and send it to the servlet requested. This image should be shown to the Client whenever he logs in or anyone checks his profile. regards Prashanth