i want to download images of any type from the server.my server is unix based.i need help help in coding.what should i give as content type in the response of jsp. i am using jsp. i had given image/jpg or image.gif as content type.but it is giving error as no preview parameters. help me.. thanks pravii
JSP is optimized for text - images are binary. The best way to serve binary data is through a servlet where you have total control over the response and can set the content type and length. Servlets are just as simple as JSP, after all, a JSP is turned into a servlet. There is no reason not to use a mix of JSP and servlets for your application. Bill
I've got an issue with this approach... I have a JSP file that has the following (<> removed so you can see the syntax): IMG SRC="/servlet/imageservlet?id=6" The problem is when I refresh the page, sometimes the image appears, sometimes it doesn't... The same code, pointing to a PHP file for image retrieval works just fine... Any suggestion? P.S. The "id=" is pulling the image from a mySQL DB given the "id" of the image table.