chart.jsp 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. <%@ page contentType="text/html;charset=GBK"%>
  2. <%@ page import="com.yw.core.jfreechart.service.Chart"%>
  3. <%@ page import="java.io.InputStream"%>
  4. <%@ page import="com.yw.core.jfreechart.model.DisplayModel"%>
  5. <%@ page import = "java.io.PrintWriter" %>
  6. <%
  7. String clz = (String)request.getAttribute("classService");
  8. Class obj = Class.forName(clz);
  9. Chart chart = (Chart)obj.newInstance();
  10. DisplayModel dm=chart.getChart(session,new PrintWriter(out));
  11. String pdfFile = dm.getFileName().replace("png","pdf");
  12. String graphURL = request.getContextPath() + "/jchart.do?filename=" + dm.getFileName();
  13. %>
  14. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  18. <title>Insert title here</title>
  19. <script type="text/javascript">
  20. $(document).ready(function(){
  21. $("#displayPDF").bind("click",function(){
  22. window.open("chart/pdf/<%=pdfFile%>");
  23. });
  24. });
  25. </script>
  26. </head>
  27. <body>
  28. <div>
  29. <div><img src="<%=graphURL%>" width="500" height="300" border="0" usemap="<%=dm.getFileName()%>"></div>
  30. </div>
  31. </body>
  32. </html>