Hi all,

I need to download a zip file from the server to client browser. I have a servlet which does this --

           FileInputStream fis = new FileInputStream(uFile);
           PrintWriter pw = response.getWriter();
           int c = -1;
           //             Loop to read and write bytes.
           while ((c = fis.read()) != -1) {
               pw.print((char) c);
           }
           //             Close output and input resources.
           fis.close();
           pw.flush();


Here is the servlet mapping from web.xml --

 <servlet-mapping>
   <servlet-name>UploadServlet</servlet-name>
   <url-pattern>/servlet/uploadServlet</url-pattern>
 </servlet-mapping>


And here is what I wrote in one of my jsp's --
<html:link href="/servlet/uploadServlet?fileName=c:\\temp\\test.zip" title="Download">Download</html:link>



When I click on the link, the whole setup does work. The only thing is, instead of giving me a download window where I can "save as" the file, it simply writes the entire file in the portlet itself so I see a bunch of garbage text in my portlet.


Please please I really need help with this :-(

Thanks,
Amit



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to