我想通过从本地读取文件流的方式将pdf显示在ie中,奇怪的是在tomcat中显示正常,但是在weblogic下就不能显示了,显示的是乱码。
代码如下
<%@ page contentType="text/HTML; charset=GBK" %><%@ page import="java.io.*"%>
<%
InputStream dataIn = new FileInputStream("D:\\Tomcat5.0\\webapps\\shbank1/1.pdf");
ServletOutputStream out1 = response.getOutputStream();
byte[] b = new byte[2048];
int len = 0;
while ((len =dataIn.read(b)) > 0) {
out1.write(b, 0, len);
}
out1.flush();
out1.close();
dataIn.close();%>
代码如下
<%@ page contentType="text/HTML; charset=GBK" %><%@ page import="java.io.*"%>
<%
InputStream dataIn = new FileInputStream("D:\\Tomcat5.0\\webapps\\shbank1/1.pdf");
ServletOutputStream out1 = response.getOutputStream();
byte[] b = new byte[2048];
int len = 0;
while ((len =dataIn.read(b)) > 0) {
out1.write(b, 0, len);
}
out1.flush();
out1.close();
dataIn.close();%>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货