neha_credo
Posts: 8
|
Posted: 05/15/2007, 7:07 AM |
|
hi alll...
.i wanna display a word document file in inetrnet explorer...
i hv done this code....
all the characters are getting and... some encrypted format also coming(some symbols)..
i wanna display that file content in a good format... how can i do that.. anyone pls help me..
code i hav doneis here............................................................................................................................
<%@ page import="java.io.*,javax.servlet.http.HttpServletRequest,javax.servlet.ServletInputStream" %>
<%@ page import="java.io.FileWriter,java.io.IOException" %>
<html>
<head>
<title>
</title>
</head>
<body>
<%
try
{
String contentType = request.getContentType();
%>
Content Type:<%out.println("Content type is :: " +contentType);%><br>
<%
int len;
if ((contentType != null)&&(contentType.indexOf("multipart/form-data") >= 0))
{
DataInputStream in = new DataInputStream(request.getInputStream());
int formDataLength = request.getContentLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead < formDataLength)
{
byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
totalBytesRead += byteRead;
}
String file = new String(dataBytes);
InputStream is=new FileInputStream(file);
is.close();
}
}
catch(Exception e)
{
out.println(e);
}
%>
</body>
</html>
thanx in advance..
neha..
|
|
|
matheus
Posts: 386
|
Posted: 05/15/2007, 9:34 AM |
|
and CodeCharge relationship?
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
neha_credo
Posts: 8
|
Posted: 05/15/2007, 10:29 PM |
|
i didnt...get u?? code charge relationship means????
|
|
|
fady005
Posts: 115
|
Posted: 05/16/2007, 12:59 AM |
|
What matheus means that have you used CodeCharge to generate the code or not ? Because if not, we can't help you...
_________________
Be inventive ! |
|
|
neha_credo
Posts: 8
|
Posted: 05/16/2007, 2:12 AM |
|
i hv used the codeCharge to generate the code.
neha,,,,
|
|
|
matheus
Posts: 386
|
Posted: 05/16/2007, 4:33 AM |
|
Not to generate the code above.
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
fady005
Posts: 115
|
Posted: 05/21/2007, 1:00 AM |
|
neha this is the code of which file in CodeCharge ?
_________________
Be inventive ! |
|
|
neha_credo
Posts: 8
|
Posted: 05/21/2007, 6:21 AM |
|
no fady
|
|
|
matheus
Posts: 386
|
Posted: 05/21/2007, 9:50 AM |
|
So, you think this is right forum?
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
neha_credo
Posts: 8
|
Posted: 05/21/2007, 9:07 PM |
|
ya...sure.. i didnt get my answer... i heard with POI i can do this... but i can't download the jar file.. how can i do that..in google i gave POI in the first page i can see all the packages.. when im downloading that one .. i can't get any jar files..pls help me.
neha
|
|
|
matheus
Posts: 386
|
Posted: 05/22/2007, 4:57 AM |
|
And relation POI - Codecharge where are?
neha_credo, have thousands of pure Java in web, please get information there.
If you couldn't download jar files from official apache website, imagine ....
http://www.apache.org/dist/jakarta/poi/release/bin/
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
privatemiao
Posts: 17
|
Posted: 03/23/2008, 9:23 PM |
|
you must set the page header befor
response.setHeader ("Content-Disposition", "inline;filename=anyfilename');
and if you want client download you can set the parameter attachment replace inline.
_________________
me was me |
|
|