Meaningless Drivel is fun!*
The moose likes JSP and the fly likes Junk characters while reading an excel file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Junk characters while reading an excel file " Watch "Junk characters while reading an excel file " New topic
Author

Junk characters while reading an excel file

Rakesh Gadre
Ranch Hand

Joined: Feb 22, 2003
Posts: 47
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.*,java.io.* "%>
<html>
<%
String fileNameWithPath = "C:\\test.xls";
FileInputStream fileStream = new FileInputStream (fileNameWithPath);
intnumberOfBytes = fileStream.available ();
byte contents [] = new byte [numberOfBytes];
fileStream.read (contents);
ServletOutputStream sout = response.getOutputStream();
response.setContentType("application/vnd.ms-excel");

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

</html>
**********************************************
Thanks in advance

Cheers !!

Rakesh
 
Don't get me started about those stupid light bulbs.
 
subject: Junk characters while reading an excel file