当点击"查看详情"的时候,弹出pdf解析出来的图片

1.父页面index.jsp

 window.showModalDialog("<%=basePath%>/GroupAgencySell/productDetailShow.jsp",tugissPdfpicpath,"status:no;scroll:yes;dialogWidth:800px;dialogHeight:1000px"); 

2.子页面showModalDialog 弹出的页面 productDetailShow.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<% 
String path = request.getContextPath(); 
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 
%> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
div#download{
  height:20px
}
</style>
<script type='text/javascript' src='<%=basePath%>GroupSellCss/scripts/jquery-1.11.0.min.js'></script>
<script type="text/javascript">
$(document).ready(function(){
	//alert('test1');
	var obj = window.dialogArguments;//获取父页面传递过来的参数
	//alert("${pageContext.request.contextPath}");
	$.ajax({
		type : "post",
		url : "${pageContext.request.contextPath}/json/getProductDetail.action",
		data : {
			"tugissPdfpicpath" : obj
		},
		dataType : "json",
		success : function(data) {
			var json = $.parseJSON(data);
			alert(data);
			if (json.status == "success") {
				var size = json.jsonData.length;
				var dvobj = document.getElementById('html');
				for (var i = size - 1; i >= 0; i--) {
					var imgSmallObj = document.createElement('img');//创建一个DOM元素(<img src="" />)
					imgSmallObj.id = "img_" + i;
					imgSmallObj.src = json.jsonData[i];
					imgSmallObj.style.width = "800px";
					dvobj.insertBefore(imgSmallObj, dvobj.firstChild);
				}
			}
		}
	});
	
});

</script>
</head>
<body>
<div id="html">
</div>
<%-- 下载PDF --%>
<div id="download" >
<input type="button" name="submit" value="提交" />
</div>
</body>
</html>

猜你喜欢

转载自weigang-gao.iteye.com/blog/2218089