The following code snippet shows you how to download content i.e PDF and Excel files from Server. Since its a JSP page the output stream has been cleared so binary content will not be corrupted. Code can be converted to a servlet if required To change to other content formats for download just change setContentType e.g response.setContentType("image/png");
Quick code snippets covering Java, Vb.net/C#, Spring, hibernate, sometimes having example code snippets sparks new creative ideas