بتاريخ: 4 يناير 201610 سنة comment_269877 التقرير شغال تمام في run لكن مش شغال التقرير بعد الdeployment هل المكان اللي فيه الbean والتقرير والصفحة بيحصل فيه تغير بعد الdeployment واللي أحط كله في نفس المكان ؟؟؟؟؟؟ تقديم بلاغ
بتاريخ: 4 يناير 201610 سنة كاتب الموضوع comment_269900 طب معليش انا عندي مشكلة في فهم المسارات وبحاول أهرب من المشكلة بوضع jsp page and report in \ViewController\public_html and the bean that call report in ViewController\classes when i call report by runReport("rep.jasper", m); use this code public String runReport() { String rd1 =it1.getValue().toString(); String rd2 =it2.getValue().toString(); Map m = new HashMap(); m.put("pmonq_date1", rd1); m.put("pmonq_date2", rd2); try { runreportaction2("rmota.jasper", null); } catch (Exception e) { } return null; } public ServletContext getContext() { return (ServletContext)getFacesContext().getExternalContext().getContext(); } public HttpServletResponse getResponse() { return (HttpServletResponse)getFacesContext().getExternalContext().getResponse(); } public static FacesContext getFacesContext() { return FacesContext.getCurrentInstance(); } public void runreportaction2(String repPath, java.util.Map param) throws Exception { Connection conn = null; try { HttpServletResponse response = getResponse(); ServletOutputStream out = response.getOutputStream(); response.setHeader("Cache-Control", "max-age=0"); response.setContentType("application/pdf"); ServletContext context = getContext(); String mypath =("/rmota.jrxml"); File f = new File(mypath); InputStream fs = context.getResourceAsStream("/rmota.jrxml"); String root =context.getRealPath("/"); JasperDesign design = JRXmlLoader.load(fs); JasperReport report = JasperCompileManager.compileReport(design); report.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL); Context ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/motaDS"); Connection conn1 = ds.getConnection(); JasperPrint print = JasperFillManager.fillReport(report, param,conn1); ByteArrayOutputStream baos = new ByteArrayOutputStream(); JasperExportManager.exportReportToPdfStream(print, baos); out.write(baos.toByteArray()); out.flush(); out.close(); FacesContext.getCurrentInstance().responseComplete(); } catch (Exception jex) { jex.printStackTrace(); } finally { close(conn); } } public void close(Connection con) { if (con != null) { try { con.close(); } catch (Exception e) { } } } فين المسار اللي بيادي على التقرير في الكود ده بينادي علية jasper ولا jrxml تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.