你可以作成几个页面,在主页面中include那几页。

解决方案 »

  1.   

    用if不行,打开word文档时是乱码阿!!
    另外还有excel和ppt,他们怎么打开阿???
      

  2.   

    程序是这样的,帮忙解决一下,谢谢 
    sql="SELECT nid, ntitle, ncontent, filename, document FROM test where nid='"+id+"'";
    rs=DBConn.perFORMSQL(sql);
    if(rs.next()){
    String filename=rs.getString("filename");
    int intd=filename.lastIndexOf(".");
    String suffix=filename.substring(intd+1,filename.length());
    out.print("suffix="+suffix);
    byte[] document=rs.getBytes("document");
    if(suffix.equals("doc")){
    response.setContentType("application/msword");
    }else if(suffix.equals("xls")){
    response.setContentType("application/vnd.ms-excel");
    }else if(suffix.equals("ppt")){
    response.setContentType("application/vnd.ms-powerpoint");
    }else{
    response.setContentType("text/html");用这时是乱码。
             或response.setContentType("image/jpeg");用这就打不开了。          
    }
    ServletOutputStream op = response.getOutputStream();
    op.write(document);
    op.flush();
    op.close();
    }
      

  3.   

    这句:
    out.print("suffix="+suffix);
    删掉确保你没有做除了op.write外任何针对输出流操作,另外如果去掉out.print("suffix="+suffix);还不行就把你的整个代码放上来。最后就是:你最好用Servlet而不是JSP
      

  4.   

    这句:
    out.print("suffix="+suffix);
    删掉确保你没有做除了op.write外任何针对输出流操作,另外如果去掉out.print("suffix="+suffix);还不行就把你的整个代码放上来。最后就是:你最好用Servlet而不是JSP