jsp中如何读取word里面的内容

来源:百度知道 编辑:UC知道 时间:2024/06/21 14:58:22
jsp中如何读取word里面的内容,急!!!!

手写一个,希望对你有帮助
<%@page contentType="text/html;charset=gb2312"inport="java.io.*"%>
<%
try{
InputSteam in=getServletContext().getResourceAsStrean("/test.doc");
String file="";
int temp=0;
while((temp=in.read())!=-1)
{
file+=(char)temp;
}
in.close;
out.println(new String(file.getBytes("iso-8859-1")));
out.flush();
}
catch(Exception e)
{
e.printStackTrance();
}
%>