前景提要
HDC调试需求开发(15万预算),能者速来!>>> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="java.io.*"%> <%@page import="java.util.*"%> <%@page import="com.horizon.db.Access"%> <% String path=request.getContextPath(); System.out.println(path); String workid=request.getParameter("workid"); String sql = "select * from document_file where recordid='"+workid+"'"; System.out.println("sql====="+sql); List listaid = Access.getMultiList(sql, null); System.out.println(listaid.size()); if(listaid.size()>0){ String fileid = String.valueOf(((List) listaid.get(0)).get(0)); System.out.println(fileid); byte[] byteblob = Access.getBlobContentBytes("DOCUMENT_FILE","FILEBODY","where recordid ='"+workid+"'","system"); response.reset(); response.setHeader("Content-Disposition", "attachement;filename=fujian.doc;"); //String s=new String(byteblob.getBytes("IS0-8859-1","GBK")); // response.setContentType("application/msword;charset=GBK"); response.setContentType("application/x-msdownload"); //response.setContentType("text/html;charset=utf-8"); OutputStream output=response.getOutputStream(); output.flush(); if(byteblob!=null){ InputStream in = new ByteArrayInputStream(byteblob); byte[] buf=new byte[4096]; int len = 0; while ((len = in.read(buf)) > 0) { output.write(buf, 0, len); } in.close(); output.flush(); output.close(); output=null; response.flushBuffer(); out.clear(); out = pageContext.pushBody(); } }else{ %> <div> </div> <div align="center" style="color:red">相关的正文不存在!</div>
<% }%>
怎么讲获取的word数据显示在jsp页面上,不需要下载