【发布时间】:2017-04-15 10:10:20
【问题描述】:
img 标签在 Chrome 上不显示,但在 IE 和 Firefox 上运行良好 这些是 JSP 页面:
try {
response.setContentType("image/jpeg");
Linear barcode = new Linear();
barcode.setType(Linear.CODE11);
barcode.setData("12345678912");
barcode.setUOM(Linear.UOM_PIXEL);
barcode.setX(3f);
barcode.setY(75f);
barcode.setLeftMargin(0f);
barcode.setRightMargin(0f);
barcode.setTopMargin(0f);
barcode.setBottomMargin(0f);
barcode.setResolution(72);
barcode.setShowText(true);
barcode.setTextFont(new Font("Arial", 0, 12));
barcode.setRotate(Linear.ANGLE_0);
File bimg = new File(barcode.getData());
System.out.println(bimg.length());
ImageIO.write(barcode.renderBarcode(), "jpeg", response.getOutputStream());
} catch (Exception e) {
System.out.println(e);
}
%>
getbarcode.jsp
<img id="images" height="100px" width="300px" src="barcodecode.jsp">
我使用的是 chrom 版本 57.0.2987.133(64 位)和 NetBean 8.0.2
【问题讨论】:
-
在 Chrome 中按 F12 看看发生了什么。检索图像需要单独访问服务器,因此您应该能够找出问题所在。
-
k 。我发现......在网络标签中我得到“net :: ERR_INCOMPLETE_CHUNKED_ENCODING”......我在谷歌上搜索了很多......但问题仍然没有解决。
-
我禁用或删除了所有扩展,并且在 chrome 中未选中“使用预测服务加载”......
-
请帮助解决这个问题。提前致谢。