Set filename using setHeader()
If you are serving a image or a file using jsp, you don't want to give the user the filename "file.jsp" when saving.
Using the response.setHeader() method you can easy set the filename and extention as you like.
response.setContentType("image/jpeg");
response.setHeader(
"Content-Disposition",
"attachment;filename=MyFilename.jpg;"
);
When the user tries to save your image you have used a jsp file to serve, the save as box shows "MyFilename.jpg" as the filename and not the "image.jsp".
If you are serving other fileformats, remember to change the content type.