الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

adf call jasper report from Servlet

Featured Replies

بتاريخ:

السلام عليكم

كان عندي مشكلة فى كود  call jasper report from Servlet

فى خطاء  فى هذا الجزء CreateRootApplicationModule    كما فى الصورة المرفقه

وهذا الكود الذي تم كتابة

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        
                PreparedStatement st = null;
                String amDef = "STORE1.AppModuleSTORE1";
                String config = "AppModuleSTORE1Local";

                AppModuleImpl am = (AppModuleImpl)Configuration.createRootApplicationModule(amDef,config);     
 
                st = am.getDBTransaction().createPreparedStatement("select 1 from dual", 0);
                Connection conn = null;    
        String reportName = request.getParameter("rn");
        String id = request.getParameter("id"); 
       try {
              conn = st.getConnection();
           
       } catch (Exception e) {
            // TODO: Add catch code
            System.out.println("Error1 getDBTansactio jasper:" + e.getMessage());
            
            InputStream input =
            new FileInputStream (new File(getServletConfig().getServletContext().getRealPath("/Reports/"+reportName +".jrxml")));
            JasperDesign design = null ;
            
            try {
                 design  = JRXmlLoader.load(input);
          
           } catch (JRException ex) {
                // TODO: Add catch code
                System.out.println("Error2 JasperDesign JRXmlLoader:" + ex.getMessage());
            }
            JasperReport report = null ;
            
            try {
               report = JasperCompileManager.compileReport(design);
               report = (JasperReport)JRLoader.loadObject(input);
               report.setWhenNoDataType(WhenNoDataTypeEnum.NO_DATA_SECTION);
                
                ;
           } catch (JRException ex) {
                // TODO: Add catch code
                System.out.println("error 3 JasperCompileManager:" + ex.getMessage());
            }
            
            //set Parm
            Map parm = new HashMap();
            parm.put("pDept",id);
            JasperPrint jasperPrint= null;
            
        try {
               jasperPrint = JasperFillManager.fillReport(report,parm,conn);
               
           } catch (JRException ex) {
                // TODO: Add catch code
                System.out.println("error 4 JasperPrint  JasperFillManager.fillReport:" + ex.getMessage());
            }
            
            OutputStream ouputStream = response.getOutputStream();
            
            response.setContentType("application/pdf");
            response.setHeader("Cache-Control", "max-age=0");
            JRExporter exporter = new JRPdfExporter();
            exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);  
            exporter.setParameter(JRExporterParameter.OUTPUT_STREAM,ouputStream);
            
            try {
               exporter.exportReport();
                
           } catch (JRException ex) {
                // TODO: Add catch code
                
                System.out.println("error 6 jreexpter   JasperFillManager.fformat:" + ex.getMessage());
            } finally{
           
            if(ouputStream != null){
                
                try {
                   ouputStream.flush();
                   ouputStream.close();
                    
               } catch (IOException ex) {
                    // TODO: Add catch code
                    System.out.println(ex.getMessage());
                    throw(ex);
                }
                

            }

     
        }         
    }  
    } 

   

 

 

1.png

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.