hi alll..
i wanna display a word file content in a browser..how can i do that..i hav done one coding in that i can display the contents...but with contents some symbols also coming...
anyone pls help me
my code...
<%@ page import="java.io .*,javax.servle t.http.HttpServ letRequest,java x.servlet.Servl etInputStream" %>
<%@ page import="java.io .FileWriter,jav a.io.IOExceptio n" %>
<html>
<head>
<title>
</title>
</head>
<body>
<%
try
{
String contentType = request.getCont entType();
%>
Content Type:<%out.prin tln("Content type is :: " +contentType);% ><br>
<%
int len;
if ((contentType != null)&&(content Type.indexOf("m ultipart/form-data") >= 0))
{
DataInputStream in = new DataInputStream (request.getInp utStream());
int formDataLength = request.getCont entLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead < formDataLength)
{
byteRead = in.read(dataByt es, totalBytesRead, formDataLength) ;
totalBytesRead += byteRead;
}
String file = new String(dataByte s);
InputStream is=new FileInputStream (file);
is.close();
}
}
catch(Exception e)
{
out.println(e);
}
%>
</body>
</html>
wtz wrong in that???? help me..
neha..
i wanna display a word file content in a browser..how can i do that..i hav done one coding in that i can display the contents...but with contents some symbols also coming...
anyone pls help me
my code...
<%@ page import="java.io .*,javax.servle t.http.HttpServ letRequest,java x.servlet.Servl etInputStream" %>
<%@ page import="java.io .FileWriter,jav a.io.IOExceptio n" %>
<html>
<head>
<title>
</title>
</head>
<body>
<%
try
{
String contentType = request.getCont entType();
%>
Content Type:<%out.prin tln("Content type is :: " +contentType);% ><br>
<%
int len;
if ((contentType != null)&&(content Type.indexOf("m ultipart/form-data") >= 0))
{
DataInputStream in = new DataInputStream (request.getInp utStream());
int formDataLength = request.getCont entLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead < formDataLength)
{
byteRead = in.read(dataByt es, totalBytesRead, formDataLength) ;
totalBytesRead += byteRead;
}
String file = new String(dataByte s);
InputStream is=new FileInputStream (file);
is.close();
}
}
catch(Exception e)
{
out.println(e);
}
%>
</body>
</html>
wtz wrong in that???? help me..
neha..