Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC JSP Page show report on specific time interval
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Anjali
JSP Page show report on specific time interval
1 Answer(s)      6 years and 7 months ago
Posted in : JDBC


I want to display the report at the specific time from the data base in my JSP page


Advertisement
View Answers

November 16, 2011 at 12:36 PM


Here is the program and you need a xml file where your sql qurys would be there.

catgory.xml

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" 
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="PDFReport" pageWidth="975">
<reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="15" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<reportFont name="Arial_Bold" isDefault="false" fontName="Arial" size="15" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<reportFont name="Arial_Italic" isDefault="false" fontName="Arial" size="12" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<parameter name="id" class="java.lang.Integer"/>
<parameter name="ReportTitle" class="java.lang.String"/>

<queryString><![CDATA[SELECT Stu_Id, Stu_Name, Stu_Class FROM stu_table_backup WHERE Stu_Id=$P{id}]]></queryString>
<field name="Stu_Id" class="java.lang.Integer"/>
<field name="Stu_Name" class="java.lang.String"/>
<field name="Stu_Class" class="java.lang.String"/>
<title>
    <band height="50">
      <textField>
        <reportElement x="350" y="0" width="200" height="50" />       
        <textFieldExpression class="java.lang.String">$P{ReportTitle}</textFieldExpression>
      </textField>
    </band>
</title>
 <pageHeader>
    <band>
    </band>
  </pageHeader>
 <columnHeader>
    <band height="20">
      <staticText>
        <reportElement x="0" y="0" width="100" height="20"/>
        <textElement>
          <font isUnderline="false" reportFont="Arial_Bold"/>
        </textElement>
        <text><![CDATA[Stu_Id]]></text>
      </staticText>
     <staticText>
        <reportElement x="125" y="0" width="100" height="20"/>
        <textElement>
          <font isUnderline="false" reportFont="Arial_Bold"/>
        </textElement>
        <text><![CDATA[Stu_Name]]></text>
      </staticText>
      <staticText>
        <reportElement x="250" y="0" width="150" height="20"/>
        <textElement>
          <font isUnderline="false" reportFont="Arial_Bold"/>
        </textElement>
        <text><![CDATA[Stu_Class]]></text>
      </staticText>



    </band>
  </columnHeader>
<detail>
    <band height="20">
      <textField>
        <reportElement x="0" y="0" width="100" height="20"/>


        <textFieldExpression class="java.lang.Integer"><![CDATA[$F{Stu_Id}]]></textFieldExpression>
      </textField>
      <textField pattern="0.00">
        <reportElement x="125" y="0" width="100" height="20"/>
        <textFieldExpression class="java.lang.String"><![CDATA[$F{Stu_Name}]]></textFieldExpression>
      </textField>

      <textField pattern="0.00">
        <reportElement x="250" y="0" width="150" height="20"/>
        <textFieldExpression class="java.lang.String"><![CDATA[$F{Stu_Class}]]></textFieldExpression>
      </textField>



    </band>
  </detail>
<columnFooter>
    <band>
    </band>
  </columnFooter>
<pageFooter>
    <band height="15">
      <staticText>
        <reportElement x="0" y="0" width="40" height="15"/>
         <textElement>
          <font isUnderline="false" reportFont="Arial_Italic"/>
        </textElement>
        <text><![CDATA[Page #]]></text>
      </staticText>
      <textField>
        <reportElement x="40" y="0" width="100" height="15"/>
        <textElement>
          <font isUnderline="false" reportFont="Arial_Italic"/>
        </textElement>
        <textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
      </textField>
    </band>
  </pageFooter>
<summary>
    <band>
    </band>
  </summary>
</jasperReport>

java program

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author chandan
 */
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.*;

import java.util.HashMap;

import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperPrintManager;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.export.JRXlsExporter;

public class Report {

    public static void main(String args[]) {
        JasperReport jasperReport;
        JasperPrint jasperPrint;
        Connection con = null;
        Statement smt = null;

        try {
            HashMap jasperParameter = new HashMap();

            Class.forName("com.mysql.jdbc.Driver");
            String URL = "jdbc:mysql://localhost:3306/test";
            con = DriverManager.getConnection(URL, "root", "root");
            jasperParameter.put("id", new Integer(4));
            jasperReport = JasperCompileManager.compileReport("C:/catalog.xml");
            jasperPrint = JasperFillManager.fillReport(jasperReport, jasperParameter, con);
            JasperPrintManager.printPage(jasperPrint, 0, true);

           // JRXlsExporter exporter = new JRXlsExporter();
       // exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
      //  exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "E:/simple_report.xls");
      //  exporter.exportReport();

        } catch (Exception e) {
            e.printStackTrace();
        }




    }
}

Just try it.it will work


Related Tutorials/Questions & Answers:
MySql Time Interval
MySql Time Interval This example illustrates how to get date and time between specific time interval. In this example we create a query "select...; to find the data between specified interval. The BETWEEN and AND keyword are used
uitableviewcell loading time interval
uitableviewcell loading time interval  How can i check the time interval between loading the two cells in UITableViewCell? Please suggest. Thanks... time intervals between two cells in XCode. Just see the given lines of code
Advertisements
Report - JDBC
JSP Page show report on specific time interval  I want to display the report at the specific time from the data base in my JSP page
how to set time in jsp page
how to set time in jsp page   I need code for set the time in jsp code .iam using struts frame work back end oracle 10g ide is eclipse 6.0
Upload file on server automatically on specific time - JSP-Servlet
Upload file on server automatically on specific time  Hi all, Is there any way to upload file on server on specific time automatically using java...-determined (scheduled) time arrives. Quartz is quite flexible. It contains
Show image and text on same jsp page
Show image and text on same jsp page  Hi all, I have to display image and text on the same jsp page. The text and image are both retrived from mysql database. The image is shown correctly on seperate jsp page but when shown
report generation using jsp
report generation using jsp  report generation coding using jsp
Dirty page and Dirty report
Dirty page and Dirty report  hiii, Explain dirty page and dirty report?   hello, Dirty Pages: Data that which is modified and Stored in the buffer cache but has not yet been written in to the secondary storage
HOW TO SHOW TIME SERIES
HOW TO SHOW TIME SERIES  hi................ i require a small code in java swings to display the output as time series. Can u plz help???????? Reply....... thanks in advance
how to show effect (visual) on jsp page using value from database
how to show effect (visual) on jsp page using value from database  I am making a ticket booking system. I have a databse with a clumn "booking status" I am thinking to use a map of seats ( with pictures controllers as seats) What
How to Autogenerate of ID from database and show on JSP page?
How to Autogenerate of ID from database and show on JSP page?  ... increasin 1 in the previously stored tsk id) on JSP page when I click... tasks id as primay key, I am using JSP and struts for database connectivity,Now I
How to Autogenerate of ID from database and show on JSP page?
How to Autogenerate of ID from database and show on JSP page?  ... increasin 1 in the previously stored tsk id) on JSP page when I click... tasks id as primay key, I am using JSP and struts for database connectivity,Now I
How to Autogenerate of ID from database and show on JSP page?
How to Autogenerate of ID from database and show on JSP page?  ... increasin 1 in the previously stored tsk id) on JSP page when I click... tasks id as primay key, I am using JSP and struts for database connectivity,Now I
How to Autogenerate of ID from database and show on JSP page?
How to Autogenerate of ID from database and show on JSP page?  ... tasks id as primay key, I am using JSP and struts for database connectivity,Now I can update my database but i want to autogenerate tasks id in numbers on JSP
To create crystal report in JSP using neatbeans
To create crystal report in JSP using neatbeans  How to create crystal report in JSP using neatbeans 6.9.1.
excel report fro jsp mysql
excel report fro jsp mysql  Dear Sir, I am facing some problem while generating excel report form mysql database using jsp code. With the help from your site, I can able to generate excel file for all data types other than blob
generate graf report.. - JSP-Interview Questions
generate graf report..  How to generate report(graf) using jsp code
Adding image to database through jsp or HTML page ,while adding only image should show.
Adding image to database through jsp or HTML page ,while adding only image should show.   Adding image to database through jsp or HTML page... different jsp or HTML page. please help me. Thanks in Advance
Time Calculation - JSP-Servlet
stored start and end time and also the interval the client will attend the customer. i am trying to show the slot time to the customer to make an appointment...Time Calculation  I am using Time data type to store the start
report
report  how to take input from number of classes like order, bill,customer to another class say report to make a report on all these things
Java interval problem - Java Beginners
Java interval problem  I want to create a problem that finds the common interval of some periods of hours. For example if i have the time period: 10.00-12.00 and i have the time period: 11.00-13.00, i want to find the common
Page Loading Time
Page Loading Time  I have a application which has a tab type structure in the JSP front end and Java backend. On clicking a tab, it opens the list..., a page opens(ajax calls to server) which has atleast two iframes in it. I want
report generation
report generation  i need to show the report between two dates in jsp is it possible
how to generate the pdf report from jsp
how to generate the pdf report from jsp  <%@page import="com.itextpdf.text.,com.itextpdf.text.pdf.,java.io.*;"%> </head> <... want to generate the pdf file from jsp page.I add the itext.jar to the libraries
JSP Excel report download for .xlsx format
JSP Excel report download for .xlsx format  <%@ page contentType="application/vnd.ms-excel" pageEncoding="ISO-8859-1"%> <%response.setHeader... the code like this <%@ page contentType="application/vnd.ms-excel
Nb hours between 2 time stamps meets specific criteria
Nb hours between 2 time stamps meets specific criteria  sql - I have 2 columns with time stamps and 2 empty columns, named DAYHOURS AND NIGHTHOURS. I want to update DAYHOURS and NIGHTHOURS with Number of hours fall under - 06:00
Show number of refresh done to web page in jsp
Description: In this example there are two files index .jsp and PageCounter.jsp. The index.jsp display the number of time you refresh index.jsp page. Initially the counter in 1. It keep incrementing when you refresh the page. Static
JSp session time out
JSp session time out  Consider a case where we are working on a java... the maximum time in seconds before a session becomes invalid. Its syntax is: session.setMaxInactiveInterval(int interval); And if you want to specify
jasper report
jasper report  Sir, I have created report using ireport3 in netbeans but i am not able to show the report in jsp and also want to show the dynamicaly generated reports and aslo show in pdf and excel Please help Thanks
hide and show result in jsp
="sql" uri="http://java.sun.com/jsp/jstl/sql"%> <%@ page language ="java...="http://java.sun.com/jsp/jstl/sql"%> <%@page import="java.sql.*"%>...hide and show result in jsp  what codes do i have to change to make
how to set break in jasper report using ireport - JSP-Servlet
how to set break in jasper report using ireport  hai i have one doubt pls help , how to set page break in jasper with ireport i need urgently pls help me  In iReport3.0.0 - go to view->report group ->new : check
 

 

 

DMCA.com