How can I download an image file when I hit the submit button. I uses the code in HFSJ(page 129) but it didn't work even the jar file which is mentioned in the book. I got the servlet class file mentioning it's url pattern. Can some one help me to download an image
application/jar is not the correct content type for an image. For a JPEG I believe it's image/jpeg. It's definitely not downloading the servlet class, but in fact the image. But since you haven't given it a name, it's substituting the URL for it.
But it seems that you are in fact downloading a jar file. There's a disconnect somewhere between the code and your mentioning that you want to download an image.