原创
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
后台代码:
WebUtils.getRequest().setCharacterEncoding("utf-8");	WebUtils.getResponse().setCharacterEncoding("utf-8");	InputStream fis=null;	URL url = new URL(filePath);	URLConnection connection = url.openConnection();	HttpURLConnection conn=(HttpURLConnection) connection; conn.setConnectTimeout(20000); conn.setReadTimeout(20000); conn.connect(); WebUtils.getResponse().setContentType("application/pdf");	ServletOutputStream sos=WebUtils.getResponse().getOutputStream();	fis=conn.getInputStream();	int b;	while((b=fis.read())!=-1){	sos.write(b);	}	sos.close();	fis.close();
前端页面:
">合同预览