我通过java生成了一个base64的String,怎么传到前台js中?我的代码如下,传不过去
InputStream in = null;
byte[] data = null;
// 读取图片字节数组
try {
in = new FileInputStream(imgFile);
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
// 对字节数组Base64编码
BASE64Encoder encoder = new BASE64Encoder();
String encodeStr = encoder.encode(data);
System.out.println(encodeStr);
return encodeStr;// 返回Base64编码过的字节数组字符串
}
//调用上面方法获取s
String s = EdorPubFun.getPDFStr(reportPathName);//
//将流传给js
<html>
parent.fraInterface.GDYMBX_ShowPDFSign("<%=s%>");我看不懂,就猜一下,转json
不就是个String,该怎么传就这么传,,,你把它当做一个String字符串,我之前也有过,,对象中有个base64的的图片字符串,.然后返回到页面.通过这个base64字符串显示图片
你这不就是从后台获取的字符串嘛,请求回来,再处理。
这是Base64字符串,用常规的请求获取就行了啊