是指用word打开文档是吗,你可以向客户端输出一个流,流的属性为用word打开就可以了,不过,好像得用servlet,可能jsp也可以,我没有试过,
不过,可以给你servlet的代码
import java.io.*; public class GetFile extends HttpServlet
{
public void doGet (HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
{
try
{
byte[] fileContext=为你要输出的word的字符流
res.setContentType("application/msword");
ServletOutputStream servletOut = res.getOutputStream();
res.setContentLength(fileContext.length);
servletOut.write(fileContext);
servletOut.close();
}
}
catch(Exception e)
{
throw new ServletException(e);
}
}
}
不过,可以给你servlet的代码
import java.io.*; public class GetFile extends HttpServlet
{
public void doGet (HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
{
try
{
byte[] fileContext=为你要输出的word的字符流
res.setContentType("application/msword");
ServletOutputStream servletOut = res.getOutputStream();
res.setContentLength(fileContext.length);
servletOut.write(fileContext);
servletOut.close();
}
}
catch(Exception e)
{
throw new ServletException(e);
}
}
}
解决方案 »
- 用java导入execel或者access文件到oracle数据库,并显示到jsp页面
- JSP的四种会话跟踪技术与Servlet的生命周期
- 高手赐教
- 在线等解决方法 access denied 救救小弟吧
- OSCache缓存标签缓存时间内仍访问数据库
- lucene3分布式(查询时采用TopScoreDocCollector)报错
- 求助:如果让服务器启动的时候自动运行一个servlet?
- jsp高手请进? 在线求救。。。。
- 用HTML网页向SERVLET传递中文信息怎么是乱码?
- 想报考软件工程硕士,不知道程序员哥们们认为这个东西怎么样?有没有真正的含金量??
- help:有谁知道用Servlet上传文件?
- 中文插入SQL数据库中变成了乱码?
则用户输入http://serverUrl/servlet/servletname,他会自动调用本地的word
打开你传出的流
就像我给的例子,你可以补充fileContext的内容后就可以通过,比如打开一个服务器的word文件,将其读成字符流,然后,把servlet部署到服务器上就可以