hello Suooose i am displaying a list of file name in a JSP page and want that the user should be able to download the file as soon as he clicls on it how do i do it Amit
<I>Chance Favours the Prepared minds"</I>
sudesai
Greenhorn
Joined: Mar 30, 2001
Posts: 7
posted
0
Hi Amit, You would need to trap that filename in a variable, and then use the java.io.FileInputStream to display its contents.
Hope this helps. Regards,
Sandeep Desai <BR>[email]vgdesai@bom3.vsnl.net.in [/email]<BR><OL TYPE=1> <BR><LI><B>Sun Certified Java Programmer</B> <I>Scored 93 per cent </I><BR><LI><B>Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </B><I>Scored 56 out of 59 </I><BR><LI><B>IBM Enterprise Connectivity with J2EE </B><I> Scored 72 per cent </I><BR><LI><B>Enterprise Development on the Oracle Internet Platform </B><I> Scored 44 out of 56 </I><BR></OL>
sudesai
Greenhorn
Joined: Mar 30, 2001
Posts: 7
posted
0
Hi Amit, One more thing, that I owl like to mention.In case, your files are huge, then it would be advisable to use java.io.BufferedInputStream. You just need to change the code to :
Hope this helps, ------------------ Sandeep Desai
Sun Certified Java ProgrammerScored 93 per cent
Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
IBM Enterprise Connectivity with J2EE Scored 72 per cent
Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
Amy Hafer
Greenhorn
Joined: Mar 29, 2001
Posts: 6
posted
0
In my case, reading and then writing the fileinputstream actually dumps a bunch of binary characters from the file to a new html page with a URL of the location of the servlet. Has anyone else experienced this problem??
maha anna
Ranch Hand
Joined: Jan 31, 2000
Posts: 1467
posted
0
Did you setup the response header properly? response.setContentType("application/pdf"); //Just an example regds maha anna