JSP怎么显示word文件内容

   阅读
JSP如何显示word文件内容啊
如何才能实现,在JSP页面指定位置上,将服务器上指定目录下的word文件里的内容原样(原格式)显示出来啊?
word里有表格和文字。
要求,直接显示,而不通过设置打开或保存对话框。
直接输入像这样的地址:HTTP://路径/test.doc,会弹出对话框让选择打开或保存,所以不要告诉我用这样的方法。
用iframe src='路径/test.doc',我也试过,结果报404错误。


------解决方案--------------------
<%@page contentType="application/msword;charset=GBK" %>

------解决方案--------------------
servlet读取word输出流到jsp
jsp头上加
<%@page contentType="application/msword;charset=GBK" %> 

------解决方案--------------------
<%@ page contentType="application/msword;charset=gb2312" %>

<% 
File f=new File("D:/Tomcat 5.5/webapps/neiwang/txt/telephone.doc");
FileInputStream fin=new FileInputStream(f);
OutputStream output=response.getOutputStream();
byte[] buf=new byte[1024];
int r=0;
response.setContentType("application/msword;charset=GB2312");
while((r=fin.read(buf,0,buf.length))!=-1)
{
output.write(buf,0,r);//response.getOutputStream()
}
fin.close();
output.close();
%>

------解决方案--------------------
哇 学习了
------解决方案--------------------
探讨
<%@ page contentType="application/msword;charset=gb2312" %>

<%
File f=new File("D:/Tomcat 5.5/webapps/neiwang/txt/telephone.doc");
FileInputStream fin=new FileInputStream(f);
OutputStream output=response.getOutputStream();
byte[] buf=new byte[1024];
int r=0;
response.setContentType("application/msword;charset=GB2312");
while((r=fin.read(buf,0,buf.length))!=-1)
{
output.write(buf,0,r);//response.getOutputStream()
}
fin.close();
output.close();
%>


------解决方案--------------------
我没有做过这种但是考虑到楼主想要保持word文件在jsp显示的数据格式完全一致,我想可不可以利用dsoframer中间件直接在jsp中嵌入word,这样利用读取方式能够显示,不知道可去不可取,还望楼主定夺
------解决方案--------------------
试过 JSP 转 Word 文件, 在JSP 页面 头标签有的。。。

 读取也应该有吧 你找找
------解决方案--------------------
推荐使用FCKeditor文本编辑程序,功能强大跟微软office软件一样的功能。

不知道能不能满足lz的需求。

------解决方案--------------------
不知道SSI能不能行
------解决方案--------------------
或许应该换个思路,把word文件转为html,调用收费的ms office,免费的openoffice都可以做到这点

POI对表格或者图表貌似有兼容问题
------解决方案--------------------
用微软的dsoframer控件就可以的
------解决方案--------------------
探讨
引用:
<%@ page contentType="application/msword;charset=gb2312" %>

<%
File f=new File("D:/Tomcat 5.5/webapps/neiwang/txt/telephone.doc");
FileInputStream fin=new FileInputStream(f);
OutputStream output=response.getOutputStream();
byte[] buf=new byte[1024];
int r=0;
response.setContentType("application/msword;charset=GB2312");
while((r=fin.read(buf,0,buf.length))!=-1)
{
output.write(buf,0,r);//response.getOutputStream()
}
fin.close();
output.close();
%>


这个能否按照原来的格式显示啊?如果word里有表格等元素,还能否现实啊?
另外我想通过action来实现啊。

------解决方案--------------------
纯操作excel的话

还是建议用jxl
阅读