Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Junk characters while reading an excel file

Rakesh Gadre
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am using the following code to read an excel file using jsp/Weblogic 8.1 I have already set MIME type in weblogic. Still, it gives junk characters.

Any suggestions ???

Here is the code:
<%@ page import="java.util.*,* "%>
String fileNameWithPath = "C:\\test.xls";
FileInputStream fileStream = new FileInputStream (fileNameWithPath);
intnumberOfBytes = fileStream.available ();
byte contents [] = new byte [numberOfBytes]; (contents);
ServletOutputStream sout = response.getOutputStream();

response.setHeader("Content-Disposition","inline; filename=\"" + "MyFile" + "\";");
sout.write (contents);
sout.flush ();

Thanks in advance

Cheers !!

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic