The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Originally posted by Mladen Girazovski:
You are closing the outputstream, which flushes it, then you're trying to open it again and sending some more data through it...
open & close the outputstream outside the loop, i think you have to set the headers all at the beginning, but i could be wrong on the latter.
Originally posted by Tim Holloway:
The HTTP protocol is precisely defined as a request/response method of communication. One request, one response. Another request, another response. That's not a Java thing, it's an Internet thing.
Each response is a single "file" (data stream). When you display a web page that has several pictures on it, the initial request returns an HTML text stream response. Embedded in the returned HTML stream are links to the various pictures - each picture has its own URL. The user's browser program understands these IMG tags as an indication that it should do additional requests, one per picture - each image URL gets a response of the picture that goes with that URL.
If you actually want to send multiple files back in a single response, what you have to do is embed them in a container-type file such as a ZIP file.
From the server? No. All you can do is to send the ZIP file, it's up to the client to decide to do with it. And all the client is going to do with it is (1) save it to the client's disk -- most likely -- or (2) open it with some ZIP archive reader -- not very likely.Originally posted by Madhu Bompaly:
is there any way I can display all the iamges in a single page by reading the ZIP file.
Originally posted by Paul Clapham:
From the server? No. All you can do is to send the ZIP file, it's up to the client to decide to do with it. And all the client is going to do with it is (1) save it to the client's disk -- most likely -- or (2) open it with some ZIP archive reader -- not very likely.
If you really want to display a page of images, by far the easiest way is to send an HTML page containing links to all the images. If that was your goal then you are doing it in entirely the wrong way.
Originally posted by Madhu Bompaly:
[QBcan you please post some code for JSP [/QB]
Originally posted by Paul Clapham:
From the server? No. All you can do is to send the ZIP file, it's up to the client to decide to do with it. And all the client is going to do with it is (1) save it to the client's disk -- most likely -- or (2) open it with some ZIP archive reader -- not very likely.
If you really want to display a page of images, by far the easiest way is to send an HTML page containing links to all the images. If that was your goal then you are doing it in entirely the wrong way.