Hi.
while i am trying to respond my client with the dilaog using which a
client user could save the file , the file which is to be sent from
server .... i am facing some issues in
setContentType("Application/csv") .... (file type is csv) ... here is
the chunk of code ....
System.out.println("This line gets displayed before setting content
type");
httpservletresponse.setContentType("application/csv");
System.out.println("After setting content type") // This line never
gets displayed
httpservletresponse.setHeader("Content-Disposition","inline;
filename=" +strtemp[1]+".csv" );
try {
File uFile = new File(strFilePath);
int fSize = (int) uFile.length();
FileInputStream fis = new
FileInputStream(uFile);
PrintWriter pw =
httpservletresponse.getWriter();
int c = -1;
while ( (c = fis.read()) != -1) {
pw.print( (char) c);
}
// Close output and input resources.
fis.close();
pw.flush();
pw = null;
}
catch (Exception e) {
System.out.println("Exception is caught
");
e.printStackTrace();
Any suggestion regarding the issue will be highly obliged ...
Regards,
Madni
> while i am trying to respond my client with the dilaog using which a
> client user could save the file , the file which is to be sent from
[quoted text clipped - 7 lines]
> System.out.println("After setting content type") // This line never
> gets displayed
Sounds like you've committed the response already. What happens to any
exceptions thrown from setContentType? If there are any, what are they?
If you're swallowing them silently, what are they after you stop
swallowing them? What are you doing to the response before this line?

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
josh.s17@gmail.com - 04 Jan 2006 10:34 GMT
This is only a lunch but I think your problem might because you are
using a printwriter to send the response.
Try using an output stream instead eg
OutputStream out = httpservletresponse.getOutputStream;