الانتقال إلى المحتوى
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.

خطأ فى مناداة جاسبر ريبورت

Featured Replies

بتاريخ:

المفترض لا

لكن في هذه الحالة نقوم بالمقارنة الكاملة بين المثالين لمعرفة الاختلاف المؤدي لهذه المشكلة

  • الردود 56
  • المشاهدات 6.4k
  • البداية
  • اخر رد

أكثر المشاركين في هذا الموضوع

بتاريخ:
  • كاتب الموضوع

عملت المقارنة بين المثالين 

ده المثال الغير شغال  وهذا ما يظهر فى ال log

repPath= report1.jasper
conn= weblogic.jdbc.wrapper.PoolConnection_oracle_jdbc_driver_T4CConnection@96
<oracle.adf.view> <DocumentRenderer> <_isVersionStringHidden> <The setting to enable version display will be ignored because the application is running in production mode.> 
 
مع العلم ده شغال من ال bean    الخاص بالصفحة
 
وهذا المثال الشغال وهذا ما يظهر فى ال log
repPath= report1.jasper
conn= weblogic.jdbc.wrapper.PoolConnection_oracle_jdbc_driver_T4CConnection@89
 
وده  اللى شغال من ال class  اللى فى مثال   شرح ال jasper report
بتاريخ:
  • كاتب الموضوع

الحمد لله ظهر الخطأ  هو كنت بأستخدم button   وليس command buttun

بتاريخ:

هذا لا يسبب خطأ

لكن عموماً طالما اشتغل فجيد

بتاريخ:
  • كاتب الموضوع

هو ده الفرق الوحيد واشتغلت مجرد ما غيرت ال button   الى  command button

 

فى نفس المثال  اللى موجودد فى شرح المهندس احمد سعيد ذودت button عادية  بس داخل ال class bean  اللى فى المشروع ما اشتغلتش

 

وفى الامثل اللى انشأتها  غيرت ال button  الى command button  جميعها اشتغلت

وانا مستغرب هل هناك فرق بينهما

بتاريخ:

لا

بتاريخ:
  • كاتب الموضوع

انا اسف يا باشمهندس على الاطالة لكن الموضوع غريب

 

لماذا لم تشتغل الا بعد تغيير ال button  الى  command button(jsf .html)

 

انا شغال على jdeveloper 12c

بتاريخ:

ضع كود الزر كاملاً

بتاريخ:
  • كاتب الموضوع

لما اناديها من butt  عادية لا تعمل  

لما اناديها من command button   تشتغل

 

 

 

package view;
 
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.sql.Connection;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.naming.Context;
import javax.naming.InitialContext;
 
import javax.servlet.ServletContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
 
import javax.sql.DataSource;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
 
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.export.JRCsvExporter;
import net.sf.jasperreports.engine.export.oasis.JROdtExporter;
import net.sf.jasperreports.engine.export.ooxml.JRDocxExporter;
import net.sf.jasperreports.engine.export.ooxml.JRPptxExporter;
import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter;
 
import net.sf.jasperreports.engine.type.WhenNoDataTypeEnum;
import net.sf.jasperreports.engine.util.JRLoader;
import oracle.adf.model.BindingContext;
import oracle.binding.BindingContainer;
 
public class JasperClass {
    public JasperClass() {
    }
 
    public String report_action() {
        // Add event code here...
        try {
            runReport("report1.jasper", null);
        } catch (Exception e) {
            e.printStackTrace();
        }
 
        return null;
        }
        public void runReport(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();
            InputStream fs = context.getResourceAsStream("/Reports/" + repPath);
            //InputStream fs = context.getResourceAsStream(repPath);
          
            JasperReport template = (JasperReport)JRLoader.loadObject(fs);
           // template.setWhenNoDataType(WhenNoDataTypeEnum.NO_DATA_SECTION);
          
             template.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);
            conn = getConnection();
          
            JasperPrint print = JasperFillManager.fillReport(template, param, conn);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            JasperExportManager.exportReportToPdfStream(print, baos);
            System.out.println("repPath= "+repPath);
            System.out.println("conn= "+conn);
            out.write(baos.toByteArray());
            out.flush();
            out.close();
            FacesContext.getCurrentInstance().responseComplete();
        } catch (Exception jex) {
            jex.printStackTrace();
        } finally {
            close(conn);
        }
        }
 
        public Connection getDataSourceConnection(String dataSourceName) throws Exception {
        Context ctx = new InitialContext();
        DataSource ds = (DataSource)ctx.lookup(dataSourceName);
        return ds.getConnection();
        }
 
        private Connection getConnection() throws Exception {
        return getDataSourceConnection("java:comp/env/jdbc/TestJasper_ConnDS");
        }
 
        public ServletContext getContext() {
        return (ServletContext)getFacesContext().getExternalContext().getContext();
        }
 
        public HttpServletResponse getResponse() {
        return (HttpServletResponse)getFacesContext().getExternalContext().getResponse();
        }
 
        public static FacesContext getFacesContext() {
        return FacesContext.getCurrentInstance();
        }
 
        public BindingContainer getBindings() {
        return BindingContext.getCurrent().getCurrentBindingsEntry();
        }
 
        public void close(Connection con) {
        if (con != null) {
            try {
                con.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        }
بتاريخ:

ضع كود الزر كاملاً

بتاريخ:
  • كاتب الموضوع

 

    public String report_action() {

        // Add event code here...

        try {

            runReport("report1.jasper", null);

        } catch (Exception e) {

            e.printStackTrace();

        }

 

        return null;

        }

        public void runReport(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();

            InputStream fs = context.getResourceAsStream("/Reports/" + repPath);

            //InputStream fs = context.getResourceAsStream(repPath);

          

            JasperReport template = (JasperReport)JRLoader.loadObject(fs);

           // template.setWhenNoDataType(WhenNoDataTypeEnum.NO_DATA_SECTION);

          

             template.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);

            conn = getConnection();

          

            JasperPrint print = JasperFillManager.fillReport(template, param, conn);

            ByteArrayOutputStream baos = new ByteArrayOutputStream();

            JasperExportManager.exportReportToPdfStream(print, baos);

            System.out.println("repPath= "+repPath);

            System.out.println("conn= "+conn);

            out.write(baos.toByteArray());

            out.flush();

            out.close();

            FacesContext.getCurrentInstance().responseComplete();

        } catch (Exception jex) {

            jex.printStackTrace();

        } finally {

            close(conn);

        }

        }

 

        public Connection getDataSourceConnection(String dataSourceName) throws Exception {

        Context ctx = new InitialContext();

        DataSource ds = (DataSource)ctx.lookup(dataSourceName);

        return ds.getConnection();

        }

 

        private Connection getConnection() throws Exception {

        return getDataSourceConnection("java:comp/env/jdbc/TestJasper_ConnDS");

        }

 

        public ServletContext getContext() {

        return (ServletContext)getFacesContext().getExternalContext().getContext();

        }

 

        public HttpServletResponse getResponse() {

        return (HttpServletResponse)getFacesContext().getExternalContext().getResponse();

        }

 

        public static FacesContext getFacesContext() {

        return FacesContext.getCurrentInstance();

        }

 

        public BindingContainer getBindings() {

        return BindingContext.getCurrent().getCurrentBindingsEntry();

        }

 

        public void close(Connection con) {

        if (con != null) {

            try {

                con.close();

            } catch (Exception e) {

                e.printStackTrace();

            }

        }

 

    public String report_action() {

        // Add event code here...

        try {

            runReport("report1.jasper", null);

        } catch (Exception e) {

            e.printStackTrace();

        }

 

        return null;

        }

        public void runReport(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();

            InputStream fs = context.getResourceAsStream("/Reports/" + repPath);

            //InputStream fs = context.getResourceAsStream(repPath);

          

            JasperReport template = (JasperReport)JRLoader.loadObject(fs);

           // template.setWhenNoDataType(WhenNoDataTypeEnum.NO_DATA_SECTION);

          

             template.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);

            conn = getConnection();

          

            JasperPrint print = JasperFillManager.fillReport(template, param, conn);

            ByteArrayOutputStream baos = new ByteArrayOutputStream();

            JasperExportManager.exportReportToPdfStream(print, baos);

            System.out.println("repPath= "+repPath);

            System.out.println("conn= "+conn);

            out.write(baos.toByteArray());

            out.flush();

            out.close();

            FacesContext.getCurrentInstance().responseComplete();

        } catch (Exception jex) {

            jex.printStackTrace();

        } finally {

            close(conn);

        }

        }

 

        public Connection getDataSourceConnection(String dataSourceName) throws Exception {

        Context ctx = new InitialContext();

        DataSource ds = (DataSource)ctx.lookup(dataSourceName);

        return ds.getConnection();

        }

 

        private Connection getConnection() throws Exception {

        return getDataSourceConnection("java:comp/env/jdbc/TestJasper_ConnDS");

        }

 

        public ServletContext getContext() {

        return (ServletContext)getFacesContext().getExternalContext().getContext();

        }

 

        public HttpServletResponse getResponse() {

        return (HttpServletResponse)getFacesContext().getExternalContext().getResponse();

        }

 

        public static FacesContext getFacesContext() {

        return FacesContext.getCurrentInstance();

        }

 

        public BindingContainer getBindings() {

        return BindingContext.getCurrent().getCurrentBindingsEntry();

        }

 

        public void close(Connection con) {

        if (con != null) {

            try {

                con.close();

            } catch (Exception e) {

                e.printStackTrace();

            }

        }

 

بتاريخ:

كود الزر في الصفحة

بتاريخ:
  • كاتب الموضوع

 

ده زرار ال button  العادية  التقرير لا يعمل

 

  <af:button text="تقرير" id="b1" binding="#{backingBeanScope.backing_TestJasperRep.b1}"

                           action="#{JasperCalssRep.report_action}"/>

 

ده زرار ال command button    التقرير يشتغل

 

                <h:commandButton value="commandButton1" id="cb1"

                                 binding="#{backingBeanScope.backing_TestJasperRep.cb1}"

                                 action="#{JasperCalssRep.report_action}"/>

 

بتاريخ:

احذف خاصية binding

بتاريخ:
  • كاتب الموضوع

 

قمت بالتعديل على هذا النحو

 

<af:button text="تقرير" id="b1" 

                           action="#{JasperCalssRep.report_action}"/>

 

 

ولكن لم تشتغل

 

بتاريخ:

ما الذي حدث فيها؟

بتاريخ:
  • كاتب الموضوع

لم يظهر التقرير

بتاريخ:

هل يوجد EXCEPTION؟

بتاريخ:
  • كاتب الموضوع

لا يوجد exception

بتاريخ:

تحتاج إلى تدقيق كامل لمعرفة السبب فقد يكون هناك شئ أخر

  • بعد 1 شهر...
بتاريخ:
  • كاتب الموضوع

لما عملت كود مناداة تقرير ال jasper   من خلال صفحة فى مشروع

التقرير لا يعمل هذا هو كود الزرار 

 

    public String report_action() 
    {               
        System.out.println("runreport_repfrst");
        try {
            //runReport("Att_Dep_rep.jasper",m);
            System.out.println("runreport_rep");
            runReport("Att_Dep_rep.jasper",null);
       } catch (Exception e) {
          e.printStackTrace();
     }
        System.out.println("runreport_repLst");
        return null;
    }
 
 
وهذا ما يظهر فى ال log    
runreport_repfrst
runreport_rep
connection= weblogic.jdbc.wrapper.PoolConnection_oracle_jdbc_driver_T4CConnection@a5
repPath= Att_Dep_rep.jasper
conn= weblogic.jdbc.wrapper.PoolConnection_oracle_jdbc_driver_T4CConnection@a5
runreport_repLst
لا يعطى اية اخطاء
بتاريخ:

لا يوجد سبب واضح

المسألة تحتاج تتبع أكثر

بتاريخ:
  • كاتب الموضوع

اختارت صفحة اخرى فى المشروع ووضعت ال command buuton  اللى بنادى من خلالها على التقرير  ووضعت الكود فى ال page bean  الخاصة بهذه الصفحة واشتغلت 

لكن فى الصفحة اللى محتاج انى اشغل التقرير من خلالها التقرير لا يظهر

بتاريخ:

انظر الفرق بينهما

بتاريخ:
  • كاتب الموضوع

 

الشاشة المطلوبة كود الزر                                                

  <h:commandButton value="commandButton1" id="cb1"                                  

                                    binding="#{backingBeanScope.backing_Emp_ِAtt_Dep2.cb1}"

                                     action="#{backingBeanScope.backing_Emp_ِAtt_Dep2.report_action}"/>     

 

الشاشة اللى بتشغل التقرير

 

 <h:commandButton value="commandButton1" id="cb1"

                                     binding="#{backingBeanScope.backing_ATT_DEP_ADJ.cb1}"

                                     action="#{backingBeanScope.backing_ATT_DEP_ADJ.report_action}"/>

 

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

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

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

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

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

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.