Integration of reports Jasper - JNDI datasources

Hello

I want to use reports from Jasper to create some reports with bar charts that I send to users through emails from the APEX.

Versions of the system, I am running is: -.

Product build: 4.1.1.00.23
CORE 11.2.0.1.0 Production
NLSRTL Version 11.2.0.1.0 - Production
Oracle Database 11 g Release 11.2.0.1.0 - 64 bit Production
PL/SQL Release 11.2.0.1.0 - Production
AMT for 64-bit Windows: Version 11.2.0.1.0 - Production

I have installation Jasper report http://www.opal-consulting.de/apex/f?p=20090928:4 more

By following the instructions, I as far as the point of installation of Tomcat 7 where the JNDI datasourcse is defined.

I have that file \conf\Catalina\localhost\JasperReportsIntegration.xml facilities should have been created. Where there is no

Have I misunderstood the instructions?

Thanks, Pete

Hi Pete,.

Yes, you must install iReport for the design of your reports.
I'm not completely sure what you mean with "the format of the classpath. I assume that you refer to the "classpath" tab in tools > Options (?).

A default installation of iReport does not create Oracle JDBC driver data sources. The JasperReportsIntegration kit includes a lib folder that contains two files .jar (ojdbc14.jar is and orai18n.jar). Copy these two files in the following location: C:\Program Files\Jaspersoft\iReport-4.6.0\ireport\modules\ext. Then in iReport, go to Options > tools and click the classpath. Click on the button 'Add JAR' and select the two files .jar from above. These steps create a new JDBC Oracle driver data source. I hope that answers your question. Otherwise, provide more information and I will get back to you...

Don't mind the JasperReports server by the way. The JasperReportsIntegration kit includes all the files needed to install and configure JasperReports.

Good bye
Nick

Tags: Database

Similar Questions

  • Integration of reports Jasper - Ireports

    Hello

    I'm looking for information on how you intergrate Ireports in APEX applications

    I created the report Jasper in Ireports that has access to the SQL database.

    After creating the report to add it to an application. I hope I need to export reports of Ireports and install it in APEX somehwhere.

    I have that there is a paper / blog that has this information?

    Can someone piont me in the right direction?

    Thanks, Pete

    Versions of the system, I am running is: -.

    Product build: 4.1.1.00.23
    CORE 11.2.0.1.0 Production
    NLSRTL Version 11.2.0.1.0 - Production
    Oracle Database 11 g Release 11.2.0.1.0 - 64 bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    AMT for 64-bit Windows: Version 11.2.0.1.0 - Production

    Looks like the generated report is not a valid .pdf document.
    Have you tried a different type of output? What result you get when your report as .rtf?

  • Generate report jasper region

    Hi friends

    I've successfully generated the report jasper using adf in a 'new window' in following

    http://Sameh-Nassar.blogspot.com/2012/12/using-Jasper-report-in-ADF-application.HTML#comment-form

    How can I achieve the same click of button which is a component of the jsff pagefragment in a stubborn taskflow rendered as region in a jsf page.

    appreciate your guidance

    concerning

    jdev

    Hello

    What questions you get by using the command button. You can use code of belo

    contentType = "application/octet-stream".

    filename = "#{ITR." FileName} .pdf "/ >"

    Managed bean code...

    Try

    {

    Map data = new HashMap();

    InputStream input = new FileInputStream ("PATH to jrxml");

    ReportClass report = new ReportClass();

    ADD values to the data, for example data.put ("name", value); you need spend

    report.getConn (data entry),

    }

    catch (System.Exception e)

    {

    e.printStackTrace ();

    }

    Thank you

    Amey

  • change name jndi Datasource on jdeveloper 10.1.3.2 (not ending on "DS")

    Hello

    How can I change a name on jdeveloper 10.1.3.2 jndi Datasource?

    I Don t like it ending 'DS '.

    is this possible? I have can´t do

    Thanks for your time

    user,

    There are a few things to consider:

    (1) click on the "Data Sources" item in preferences (not one of the children) tree - you can see options to automatically update the data source elements. Change behavior if you disable these?

    (2) If you have a workspace selected when you call the OC4J Embedded Preferences dialog box, you will notice that there is Global times and the specific settings of the workspace; You probably want one of the specific workspace.

    Best,

    John

  • Integration of Jasper ADF 12 c reports

    Hello

    I use ADF 12 c, trying to incorporate reports Jasper with ADF page.

    I put Jasper reports JRXML and .jasper files compiled inside ViewController/reports.

    Now, I want to open Jasper report on click of a button.

    I used fileDownloadActionListener and the contentType value application/pdf

    I want to take the reports of the classpath and then print it as a PDF on click of a button.

    How can I do this?

    OK, I solved the error.

    I was passing the name of the subreport to bean also where she was already treated in the main report JRXML:

    I just removed the name of the subreport to bean and it works very well.

    Thank you all!

  • Jasper report renders is not the PDF file on the screen in ADF

    Im getting Error : Error While Displaying Report Page : See Console for Details


    I have all of the following Jars

    (iText - 1). 2.1.7.js2

    Jackson - core - 2.) 2.1.4

    JasperReports - 3) 5.6.0

    JasperReports - graphic - themes - 4.) 5.6.0

    JasperReports - core - 5 converter.)

    JasperReports - fonts - 6.) 5.6.0

    JCommon - 7) 1.0.15

    JFreeChart-8). 1.0.13


    Error itself:


    *java.lang.ClassCastException:  net.sf.jasperreports.engine.export.DefaultExporterFilterFactory cannot be cast to net.sf.jasperreports.engine.export.ExporterFilterFactory*  

      at net
    .sf.jasperreports.engine.export.ExporterFilterFactoryUtil.getFilterFactory(Ex  porterFilterFactoryUtil.java:53)
      at net
    .sf.jasperreports.engine.JRAbstractExporter.createFilter(JRAbstractExporter.j ava:1136)
      at net
    .sf.jasperreports.engine.JRAbstractExporter.initReport(JRAbstractExporter.jav a:726)
      at net
    .sf.jasperreports.engine.export.JRGraphics2DExporter.initReport(JRGraphics2DE  xporter.java:255)
      at net
    .sf.jasperreports.engine.JRAbstractExporter.setCurrentExporterInputItem(JRAbs  tractExporter.java:567)
      at net
    .sf.jasperreports.engine.export.JRGraphics2DExporter.exportReportToGraphics2D  (JRGraphics2DExporter.java:285)
      at net
    .sf.jasperreports.engine.export.JRGraphics2DExporter.exportReport(JRGraphics2   DExporter.java:236)
      at net
    .sf.jasperreports.view.JRViewer.paintPage(JRViewer.java:2121)
      at net
    .sf.jasperreports.view.JRViewer$PageRenderer.paintComponent(JRViewer.java:227   1)
      at javax
    .swing.JComponent.paint(JComponent.java:1054)
      at javax
    .swing.JComponent.paintChildren(JComponent.java:887)
      at javax
    .swing.JComponent.paint(JComponent.java:1063)
      at javax
    .swing.JComponent.paintChildren(JComponent.java:887)
      at javax
    .swing.JComponent.paint(JComponent.java:1063)
      at javax
    .swing.JComponent.paintChildren(JComponent.java:887)
      at javax
    .swing.JComponent.paint(JComponent.java:1063)
      at javax
    .swing.JComponent.paintChildren(JComponent.java:887)
      at javax
    .swing.JComponent.paint(JComponent.java:1063)
      at javax
    .swing.JViewport.paint(JViewport.java:731)
      at javax
    .swing.JComponent.paintChildren(JComponent.java:887)
      at javax
    .swing.JComponent.paint(JComponent.java:1063)
      at javax
    .swing.JComponent.paintChildren(JComponent.java:887)
      at javax
    .swing.JComponent.paint(JComponent.java:1063)
      at javax
    .swing.JComponent.paintChildren(JComponent.java:887)
      at javax
    .swing.JComponent.paint(JComponent.java:1063)
      at javax
    .swing.JComponent.paintChildren(JComponent.java:887)
      at javax
    .swing.JComponent.paint(JComponent.java:1063)
      at javax
    .swing.JComponent.paintChildren(JComponent.java:887)
      at javax
    .swing.JComponent.paint(JComponent.java:1063)
      at javax
    .swing.JComponent.paintChildren(JComponent.java:887)
      at javax
    .swing.JComponent.paint(JComponent.java:1063)
      at javax
    .swing.JLayeredPane.paint(JLayeredPane.java:585)
      at javax
    .swing.JComponent.paintChildren(JComponent.java:887)
      at javax
    .swing.JComponent.paintToOffscreen(JComponent.java:5226)
      at javax
    .swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:   1529)
      at javax
    .swing.RepaintManager$PaintManager.paint(RepaintManager.java:1452)
      at javax
    .swing.RepaintManager.paint(RepaintManager.java:1249)
      at javax
    .swing.JComponent.paint(JComponent.java:1040)
      at java
    .awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
      at sun
    .awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:78)
      at sun
    .awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:115)
      at java
    .awt.Container.paint(Container.java:1967)
      at java
    .awt.Window.paint(Window.java:3877)
      at javax
    .swing.RepaintManager$3.run(RepaintManager.java:819)
      at javax
    .swing.RepaintManager$3.run(RepaintManager.java:796)
      at java
    .security.AccessController.doPrivileged(Native Method)
      at java
    .security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:7   6)
      at javax
    .swing.RepaintManager.paintDirtyRegions(RepaintManager.java:796)
      at javax
    .swing.RepaintManager.paintDirtyRegions(RepaintManager.java:769)
      at javax
    .swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:718)
      at javax
    .swing.RepaintManager.access$1100(RepaintManager.java:62)
      at javax
    .swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1677)
      at java
    .awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
      at java
    .awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
      at java
    .awt.EventQueue.access$200(EventQueue.java:103)
      at java
    .awt.EventQueue$3.run(EventQueue.java:694)
      at java
    .awt.EventQueue$3.run(EventQueue.java:692)
      at java
    .security.AccessController.doPrivileged(Native Method)
      at java
    .security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:7   6)
      at java
    .awt.EventQueue.dispatchEvent(EventQueue.java:703)
      at java
    .awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242   )
      at java
    .awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
      at java
    .awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150   )
      at java
    .awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
      at java
    .awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
      at java
    .awt.EventDispatchThread.run(EventDispatchThread.java:91)



    My bean Code:


    public class PortoflioListJasper {
      
    public PortoflioListJasper() {
      
    }

      
    public String runReportAction() {
      
    System.out.println("On ReportAction");
      
    DCIteratorBinding empIter = (DCIteratorBinding)  getBindings().get("*Iterator Name*");
      
    System.out.println("On Iterator");
      
    Integer var = (Integer)   (empIter.getCurrentRow().getAttribute("Id"));
      
    System.out.println("On Attribute");
      
    Map m = new HashMap();
      
    System.out.println("On Map EmpID");
      m
    .put("name",var );// where employeeId is a jasper report parameter
      
    System.out.println("On Map " +portfolioId);
      
    try
      
    {
      runReport
    ("Reporta.jasper", m);
      
    }
      
    catch (Exception e)
      
    {
      
    }
      
    return null;
      
    }
      
    public BindingContainer getBindings()
      
    {
      
    return   BindingContext.getCurrent().getCurrentBindingsEntry();
      
    }

      
    public Connection getDataSourceConnection(String  dataSourceName)
      
    throws Exception
      
    {
      
    Context ctx = new InitialContext();
      
    DataSource ds =   (DataSource)ctx.lookup(dataSourceName);
      
    return ds.getConnection();
      
    }

      
    private Connection getConnection()
      
    {
      
    try
      
    {
      
    System.out.println("On Connection");
      
    return getDataSourceConnection("*DataSource Name*");// datasource name should be defined in weblogic

      
    }
      
    catch (Exception e) {
      
    System.out.println("On Catch");
      e
    .printStackTrace();
      
    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 runReport(String repPath, java.util.Map param) throws Exception
      
    {
      
    Connection conn = null;
      
    try
      
    {
      
    HttpServletResponse response = getResponse();
      
    System.out.println("Response : " +response);
      
    ServletOutputStream out = response.getOutputStream();
      response
    .setHeader("Cache-Control", "max-age=0");
      response
    .setContentType("application/octet-stream");
      
    ServletContext context = getContext();
      
    InputStream fs = context.getResourceAsStream("/Reports/"   + repPath);
      
    System.out.println("Response : " +repPath);
      
    System.out.println("Response : " +fs);

      
    JasperReport template = (JasperReport)   JRLoader.loadObject(fs);
      
    System.out.println("Template : " +template);
      template
    .setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);
      conn
    = getConnection();

      
    JasperPrint print =   JasperFillManager.fillReport(template, param, conn);
      
    System.out.println("PDF" +print);
      
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
      
    JasperExportManager.exportReportToPdfStream(print, baos);


      
    System.out.println("PDF" +baos);
      out
    .write(baos.toByteArray());
      
    JasperViewer view = new JasperViewer(print,false);
      view
    .setVisible(true);
      
    System.out.println("Printed");
      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)
      
    {
      
    }
      
    }
      
    }
      
    }



    @

    I want the report to display on the screen...

    Can someone tell me where Im wrong. ?

    IM I missing all jars. ?

    Help, please...

    dvohra21 Fusion Middleware Oracle Community Portal users group

    Dear

    Sorry I forgot to paste the code

    The bean code is

    package com.ash.view.backing;
    
    import java.io.ByteArrayOutputStream;
    import java.io.InputStream;
    
    import java.sql.Connection;
    
    import java.util.HashMap;
    import java.util.Map;
    
    import javax.faces.context.FacesContext;
    
    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.JasperExportManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.JasperReport;
    import net.sf.jasperreports.engine.type.WhenNoDataTypeEnum;
    import net.sf.jasperreports.engine.util.JRLoader;
    
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCIteratorBinding;
    
    import oracle.binding.BindingContainer;
    
    public class JasperBean {
    
        public String runCustomersReport() {
            // Add event code here...
            DCIteratorBinding empIter = (DCIteratorBinding) getBindings().get("CustomerView1Iterator");
                String cusId = empIter.getCurrentRow().getAttribute("CustId").toString();
                Map m = new HashMap();
                m.put("CustId", cusId);
                try
                {
                  runReport("CustomersList.jasper", m);
                }
                catch (Exception e)
                {
                }
    
            return null;
        } 
    
        public String runSalesInvoiceReport() {
            // Add event code here...
            DCIteratorBinding sinvIter = (DCIteratorBinding) getBindings().get("SalesView1Iterator");
                String sinvId = sinvIter.getCurrentRow().getAttribute("SalId").toString();
                Map m = new HashMap();
                m.put("SalId", sinvId);
                try
                {
                  runReport("SalesInvoice.jasper", m);
                }
                catch (Exception e)
                {
                }
    
            return null;
        }
    
        public BindingContainer getBindings()
        {
          return BindingContext.getCurrent().getCurrentBindingsEntry();
        }
    
        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("AshCMSConnDS");
        }
    
        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 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);
            JasperReport template = (JasperReport) JRLoader.loadObject(fs);
            template.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);
            conn = getConnection();
            JasperPrint print = JasperFillManager.fillReport(template, param, conn);
            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)
             {
             }
           }
         }
    }
    

    The servlet code is

    package com.ash.view;
    
    import com.ash.model.AppModuleImpl;
    
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PrintWriter;
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    
    import java.util.HashMap;
    import java.util.Locale;
    import java.util.Map;
    
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import net.sf.jasperreports.engine.JasperCompileManager;
    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.design.JasperDesign;
    import net.sf.jasperreports.engine.xml.JRXmlLoader;
    
    import oracle.jbo.client.Configuration;
    
    @WebServlet(name = "MultiReportServlet", urlPatterns = { "/multireportservlet" })
    public class MultiReportServlet extends HttpServlet {
        private static final String CONTENT_TYPE = "text/html; charset=UTF-8";
    
        public void init(ServletConfig config) throws ServletException {
            super.init(config);
        }
    
        protected Connection getConnection() {
    
            PreparedStatement st = null;
            String amDef = "com.ash.model.AppModule";
            String config = "AppModuleLocal";
            AppModuleImpl am = (AppModuleImpl ) Configuration.createRootApplicationModule(amDef, config);
    
            st = am.getDBTransaction().createPreparedStatement("select 1 from dual", 0);
            Connection conn = null;    
    
            try {
                conn = st.getConnection();
                return conn;
            } catch (SQLException e) {
            }   
    
            return null;
        }
    
        public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                      String var0 = "";
                      String reportName = "";
                      try {
                          reportName = request.getParameter("reportName");
                      } catch (Exception e) {
                          e.printStackTrace();
                      }
                      response.setContentType(CONTENT_TYPE);
                      Map parameters = new HashMap();
                             parameters.put("format", "pdf");
                             parameters.put("WEBDIR", getServletContext().getRealPath("/"));
                             parameters.put("REPORT_LOCALE", new Locale("ar"));  
    
                             if(reportName.equals("CustomersList"))
                             {
                                 Object value1 = request.getParameter("value1");
                                 parameters.put("p1", value1);  
    
                             }  
    
                          if(reportName.equals("SalesInvoice"))
                          {
                              Object value1 = request.getParameter("value1");
                              parameters.put("p1", value1);  
    
                          }  
    
                             Connection conn = null;
                             InputStream is = null;
                             try
                             {
                               conn = getConnection();
                               is = getServletContext().getResourceAsStream("/WEB-INF/reports/"+reportName+".jrxml");  
    
                               response.setContentType("application/pdf");
                               response.addHeader("Content-Disposition", "attachment; filename="+reportName+".pdf");  
    
                               JasperDesign jasperDesign = JRXmlLoader.load(is);
                               JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
                               JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn);
                               JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());  
    
                               conn.close();
                             }
                             catch (Exception e) {
                               e.printStackTrace();
                             } finally {
                               closeConnection(conn);
                               try {
                                   if(is !=null){
                                       is.close();
                                   }                     
    
                               } catch (Exception localException1)
                               {
                               }
                             }                      
    
                  }
        protected static void closeConnection(Connection conn) {
            try {
                if(conn !=null){
                    conn.close();
                }
            } catch (Exception ex) {
                //  System.out.println("Developer Msg : Exception in printReport1Servlet.closeConnection()");
            }
        }
    }
    

    I use three files in lib jasper

    iText - 2.1.7

    JasperReports - 4.0.1

    JasperReports-fonts - 4.0.1

    This code displays the report in adobe reader only and in the browser like firefox after some adjustments in the browser.

    Concerning

  • Jasper on oracle APEX integration error. "Error: file null.jasper not found.

    Hi all

    Recently, we have configured Oracle APEX and configured report Jasper on Glassfish 4.1. Everything went well, but when you try to run the test report we get following error.

    "Error: file null.jasper not found.

    Can anyone help with this?

    Database: Oracle 11g R2

    APEX: 4.2

    GlassFish 4.1

    Report of Jasper 1.3.0.2

    Hi Kiran,

    Thanks for your reply, we used the same link for integration.

    But now we have solved the problem. The issue was with the version of Glassfish. It seems that report jasper is not compatible with the 4.1. So, we removed 4.1 Glassfish and install Glassfish 3.1. That solved the problem for us.

  • Can a report of Jasper operate with an af:button on a page fragment (jsff) or simply on a jsf page?

    Mr President.

    Can a report of Jasper operate with an af:button on a page fragment (jsff) or simply on a jsf page?

    Because I'm running report jasper jsff page but it does not work but the same report runs on a jsf page.

    Concerning

    Cherish!

    The answer to this question is Yes

    We can run report jasper with a button on a page jsff using the servlet class

    The same code for jdev worm 12.1.3.0.0 is as below

    package ash.view;
    
    import ash.model.SchoolAppModuleImpl;
    
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PrintWriter;
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    
    import java.util.HashMap;
    import java.util.Locale;
    import java.util.Map;
    
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import net.sf.jasperreports.engine.JasperCompileManager;
    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.design.JasperDesign;
    import net.sf.jasperreports.engine.xml.JRXmlLoader;
    
    import oracle.jbo.client.Configuration;
    
    @WebServlet(name = "ReportServlet", urlPatterns = { "/reportservlet" })
    public class ReportServlet extends HttpServlet {
        private static final String CONTENT_TYPE = "text/html; charset=UTF-8";
    
        public void init(ServletConfig config) throws ServletException {
            super.init(config);
        }
    
        protected Connection getConnection() {
    
            PreparedStatement st = null;
            String amDef = "ash.model.SchoolAppModule";
            String config = "SchoolAppModuleLocal";
            SchoolAppModuleImpl am = (SchoolAppModuleImpl ) Configuration.createRootApplicationModule(amDef, config);
    
            st = am.getDBTransaction().createPreparedStatement("select 1 from dual", 0);
            Connection conn = null;    
    
            try {
                conn = st.getConnection();
                return conn;
            } catch (SQLException e) {
            }   
    
            return null;
        }
    
        public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            String var0 = "";
            try {
                var0 = request.getParameter("classId");
            } catch (Exception e) {
                e.printStackTrace();
            }
            response.setContentType(CONTENT_TYPE);
            Map parameters = new HashMap();
                   parameters.put("format", "pdf");
                   parameters.put("WEBDIR", getServletContext().getRealPath("/"));
                   parameters.put("REPORT_LOCALE", new Locale("ar"));
    
                   parameters.put("classId", new String(var0));
                   Connection conn = null;
                   InputStream is = null;
                   try
                   {
                     conn = getConnection();
                     is = getServletContext().getResourceAsStream("/WEB-INF/reports/ClassDataReport.jrxml");
    
                     response.setContentType("application/pdf");
                     response.addHeader("Content-Disposition", "attachment; filename=ClassDataReport.pdf");
    
                     JasperDesign jasperDesign = JRXmlLoader.load(is);
                     JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
                     JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn);
                     JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
    
                     conn.close();
                   }
                   catch (Exception e) {
                     e.printStackTrace();
                   } finally {
                     closeConnection(conn);
                     try {
                         if(is !=null){
                             is.close();
                         }                   
    
                     } catch (Exception localException1)
                     {
                     }
                   }
    
            PrintWriter out = response.getWriter();
            out.println("");
            out.println("ReportServlet");
            out.println("");
            out.println("

    The servlet has received a GET. This is the reply.

    "); out.println(""); out.close(); } protected static void closeConnection(Connection conn) { try { if(conn !=null){ conn.close(); } } catch (Exception ex) { // System.out.println("Developer Msg : Exception in printReport1Servlet.closeConnection()"); } } }

    Concerning

  • Change the locale for a report from jasper who was called pit utl_http

    All,

    When we call the utl_http package to generate a report of jasper within the oracle and save it as a BLOB in the default language (nls_language and nls_territory) gets crushed by AMERICA/America.

    This gives problems as decimal points and comma...

    In regard to is that I know that it is not possible to change the language within the server of jasper.

    I suspect that utl_http creates a virtual browser with a default language (AMERICAN), that it becomes hereditary by server of jasper. Is there a way to change this language?

    I've already tried
    execute immediate ('alter session set nls_language= ''DUTCH'' nls_territory= ''BELGIUM'' nls_numeric_characters='',.''');
    It did not work!

    Work around for now is to change the format mask in my report Jasper query, but so that we can do is more aggregate functions.

    Any help is greatly appreciated...

    Thnx

    Hello

    Just a guess. Try following

    req := utl_http.begin_request('http://www.psoug.org');
    utl_http.set_header(req, 'Content-Language', 'da');
    resp := utl_http.get_response(req);
    

    For more information on HTTP headers, see http://en.wikipedia.org/wiki/List_of_HTTP_header_fields

    ----
    Lavenu
    MaxApex accommodation
    http://www.maxapex.com

  • How to use datasource jndi in Weblogic instead of add a DB data source

    Hi all

    version: 11.1.1.4

    I'm trying to understand how in my ADF applications I use a datasource jndi existing on our servers weblogic instead of having to bury the source database db in my adf applications. As SOA, I would refer to the DB directly in the design so that I can pull in entities and build display objects, but when I deploy I want it references on the weblogic Server jndi datasource.

    Is this possible? If so I don't know how to configure it as I would a DB adapter in SOA.

    As always, appreciate the info.

    Thank you

    S

    If you use ADF in the model layer (application modules) you can configure them to use JNDI Datasources. Just right click on the application module and select "Configurations."... ». In the next dialog box, you see all currently available configurations (named xxxxxlocal and a xxxxxshared named at least). Select local and press change. This opening of the DB connection dialog where you can change the connection of the JDBC URL of JDBC (JNDI) data source. Save your work, and when you start now use the JNDI name.

    Timo

  • Problem report.

    Dear Experts,

    I use Jdev 11.1.1.5.0, I have developed an application and the application accessible via Integrated Weblogic Server successfully.

    Now, I installed, Standalone WLS, 10.3.5 in my system, I have deployed the. EAR file in standalone, as well as the application is accessible very well, but I can't open a report (Jasper), which shows,

    java.lang.NullPointerException

    in java.io.File. < init > (File.java:222)

    at test.stri.oracle.view.Serve.ReportServe.TEST.doPost(TEST.java:92)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:821)

    to weblogic.servlet.internal.StubSecurityHelper$ ServletServiceAction.run

    (StubSecurityHelper.java:227)

    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet (StubSecuri

    tyHelper.java:125)

    at weblogic.servlet.internal.ServletStubImpl.execute (ServletStubImpl.jav

    one: 300)

    FYI, I can generate the same report of integrated server. Someone pls guide me.

    -sep

    At the same place where is web.xml, brand new file weblogic.xml, with following content:

    "http://www.w3.org/2001/XMLSchema-instance" xsi: schemaLocation = "http://www.bea.com/ns/weblogic/weblogic-web-app.xsd" xmlns ="http://www.bea.com/ns/weblogic/weblogic-web-app" > ""

    true

    true

    true

    true

    JSTL

    1.2

    JSF

    1.2

    true

    true

    If not work, just remove the two library-ref tags (not sure what JSF version you use)

  • What is the official reporting tool Oracle JDeveloper ADF applications.

    Hi all
    I'm on the migration of Oracle Forms and Oracle JDeveloper ADF reports.
    I have read several books on JDeveloper and ADF and I take. Now what I will use to create reports; tool Oracle to create reports, that is tightly integrated with JDveloper and ADF comparable to the relationship between Oracle Forms and Oracle reports.
    I will be grateful for your response.
    Best regards,
    Denis Ojok

    There is no tool tightly coupled with jdev. Tool of oracles of choice would be BI Publisher (I guess). However, you can use the reports jasper or any other tool to report as well.

    Timo

  • Jasper compiler error

    pls watch the program below...

    < % @ page import = "java.sql. *" % >
    < %
    Connection con = null;
    PreparedStatement ps = null;
    Public Sub jspInit()
    {
    Try
    {
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.GetConnection ("JDBC:Oracle:Thin:@localhost:1521:ORCL","Scott","Tiger");
    PS = con.prepareStatement ("INSERT INTO EMPLOYEE VALUES(?,?,?)");
    } //try
    catch (ClassNotFoundException e)
    {
    e.printStackTrace ();
    }
    catch (SQLException e)
    {
    e.printStackTrace ();
    }
    } / / jspinit()
    Public Sub jspDestroy()
    {
    Try
    {
    if(PS!=null)
    PS. Close();
    if(con!=null)
    con. Close;
    }
    catch (SQLException e)
    {
    e.printStackTrace ();
    }
    } //jspDestroy
    % >
    < %
    String a = request.getParameter ("empno");
    String name = request.getParameter ("name");
    String c = request.getParameter ("salary").

    int empno = Integer.parseInt (a);
    float salary = Float.parseFloat (c);
    ps.setInt(1,empno);
    ps.setString(2,name);
    ps.setFloat(3,salary);
    ps.executeUpdate ();
    % >
    < % @ include file="emp.html"% >

    When I managed on the tomcat server, compiler jasper gave the following error:+.

    An error occurred at line: 5 in the jsp file: emp.jsp
    Syntax error on token 'Sub', @ awaited
    2: < %
    3: connection con = null;
    4: PreparedStatement ps = null;
    5: public Sub jspInit()
    6 : {}
    7: try
    8 : {}


    An error occurred at line: 5 in the jsp file: emp.jsp
    jspInit cannot be resolved to a type
    2: < %
    3: connection con = null;
    4: PreparedStatement ps = null;
    5: public Sub jspInit()
    6 : {}
    7: try
    8 : {}


    An error occurred at line: 5 in the jsp file: emp.jsp
    Syntax error, insert 'enum identifier' to full EnumHeaderName
    2: < %
    3: connection con = null;
    4: PreparedStatement ps = null;
    5: public Sub jspInit()
    6 : {}
    7: try
    8 : {}


    An error occurred at line: 5 in the jsp file: emp.jsp
    Syntax error, insert 'EnumBody' to complete BlockStatement
    2: < %
    3: connection con = null;
    4: PreparedStatement ps = null;
    5: public Sub jspInit()
    6 : {}
    7: try
    8 : {}


    An error occurred at line: 22 in the jsp file: emp.jsp
    Syntax error on token 'Sub', @ awaited
    19: e.printStackTrace ();
    20 :}
    21 :} / / jspinit()
    22: public Sub jspDestroy()
    23: {}
    24: try
    25: {}


    An error occurred at line: 22 in the jsp file: emp.jsp
    Syntax error, insert 'enum identifier' to full EnumHeaderName
    19: e.printStackTrace ();
    20 :}
    21 :} / / jspinit()
    22: public Sub jspDestroy()
    23: {}
    24: try
    25: {}


    An error occurred at line: 22 in the jsp file: emp.jsp
    Syntax error, insert 'EnumBody' to complete BlockStatement
    19: e.printStackTrace ();
    20 :}
    21 :} / / jspinit()
    22: public Sub jspDestroy()
    23: {}
    24: try
    25: {}





    ... I don't understand where is the problem. Suggestions please...

    Thanks in advance!

    Published by: Sandy on November 24, 2010 10:20

    The problem is that you try to declare a method in < scriptlet="" %="" %=""> tags.
    All methods (for example, jspInit()) must be included in< % !="" déclaration="" tags="" %="">
    See http://java.sun.com/products/jsp/syntax/2.0/syntaxref20.html if you don't understand the difference.

    But that said
    -including the code for scriptlet in JSP page are considered to be bad practice now. JSPs should only be used to generate html pages to display. If you want to run java code, put the java code in a java class (a servlet or a bean)

    -connect to a database from a JSP page is also considered bad form, for the same reason. JSPs should be your 'view', not your model or your controller.

    -Rather than to use the DriverManager.getConnection () to establish a connection to a database, the recommended method is to use a JNDI Datasource, that can handle the connection pooling for you. In this way, you don't need to worry about the connection at the time of "init" and release to 'destroy '...

    see you soon,
    evnafets

  • Creation to the format of the reports

    Hello. APEX is amazing and I would like to replace all my databases MS Access with it. My problem with APEX is the generation of attractive reports. I know that you can install BI Publisher and create reports PDF etc but to compete with access you need, I guess, BI Publisher installed in advanced mode. Looking at the Oracle site, it's hard to know how this would really be. In addition, to compete with MS Access, the cost would be competitive. Someone tried actually generate some good reports out of APEX and have you tried any 3rd party application?

    Kind regards

    Steve

    Look at the reports Jasper: http://daust.blogspot.com/2010/01/jasper-reports-integration-beta-release.html. It will generate elegant reports and fits at the APEX (using forward the package indicated links)...

    Thank you

    Tony Miller
    Webster, TX

  • integration of bi publisher forms 12 c. In is it permissible?

    Hello

    I read new forms 12 c has delivered integration bi publisher, in the same style as the integration of reports.

    What BI Publisher license? It also comes, or they are separate products?

    So far, it is produced separate and you must separate the license.

    Concerning

Maybe you are looking for

  • HP mini 110-3100: not found boot device

    Hello.. Why when I reboot my hp mini 110-3100, he says this not found boot device, please install an OS on your hard drive. so I will try to run the hard drive test and it say the drive does not exist. How I solve this problem? I try to format it, bu

  • Bluetooth device driver is not installed

    I used the fix from microsoft to resolve the above message, but he could not help. He asked me to find a solution online.  Then, I got a message that windows found driver software for your device. He asked me to download a missing driver of Broadcam

  • need to replace my heat sync

    Moreover, the fan for her but I can't seem to find a place to buy it. my computer is a HP h8-1030/computer tower. the fan does not always work and some time wherever I tried to contact the Microsoft site tech section, I had the same type of response

  • c:-&gt; windows-&gt; system32 (or syswow64)-&gt; a ring.log how can I do?

    Someone from tech support to help me with a new piece of software asked me to 'C' :-> Windows-> System32 (or SysWOW64)-> NEB Ring.log".  How do I do that?

  • Error code: 0 x 80004005 verizon Manager download

    I am trying to download manager from verizon, I get the error of 0x80004005 does code - what do I do now.