pdg是超星阅读器的专有文件,先安装一个超星阅读器,至于能否被IE支持就要试试了,不支持的话会提示下载而不会直接打开。

解决方案 »

  1.   

    如果是pdg文件作为二进制文件存在于数据库中,可以用如下的程序段打开:当然你要传一个该条记录的ID过来。
    String id = request.getParameter("id");
      String sql = "select * from archive_attach where attach_id='" + id + "'";
      Archive ar = new Archive(true);
      ResultSet rs = null;
      rs = ar.queryOracle(sql);  oracle.sql.BLOB attachLob = null;
      byte buf[] = null;
      String fileName = "";  try {
        if(rs.next()) {
          fileName = rs.getString("attach_filename");
      System.out.println("====== in the show_attach.jsp : fileName: " + fileName);
          attachLob = (oracle.sql.BLOB)rs.getBlob("attach_content");
          buf = attachLob.getBytes((long)1,(int)attachLob.length());
          response.setContentType("application/x-msdownload");
          response.setHeader("Content-Disposition", "attachment; filename=" + fileName);      //将缓冲区的输入输出到页面
          response.getOutputStream().write(buf);
          //输入完毕,清除缓冲
          response.getOutputStream().flush();
          response.getOutputStream().close();
        }
        ar.closeConnection();
      }catch(Exception e) {
        ar.closeConnection();
        System.out.println("error in show_attach.jsp: " + e.getMessage());
      }
      

  2.   

    修改tomcat/conf/web.xml文件,增加
    <mime-mapping>
            <extension>pdf</extension>
            <mime-type>application/x-msdownload</mime-type>
    </mime-mapping>
      

  3.   

    不是存在数据库中,只是把文件的路径存在数据库中。
    如果用的是weblogic服务器呢?