JSP Page show report on specific time interval

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

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
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
Advertisements
ModuleNotFoundError: No module named 'report-on-interval'
ModuleNotFoundError: No module named 'report-on-interval'  Hi, My... named 'report-on-interval' How to remove the ModuleNotFoundError: No module named 'report-on-interval' error? Thanks   Hi, In your
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
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
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 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 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
report generation using jsp
report generation using jsp  report generation coding using jsp
ModuleNotFoundError: No module named 'show-time'
ModuleNotFoundError: No module named 'show-time'  Hi, My Python... 'show-time' How to remove the ModuleNotFoundError: No module named 'show... have to install padas library. You can install show-time python with following
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
how to retrieve text and images from mysql database and show on html page using jsp servlet
how to retrieve text and images from mysql database and show on html page using jsp servlet  <%@ page language="java" contentType="text/html... {color:blue} <%@ page import="java.sql.*" %> <%@ page import
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... } Output: In the browser it will show at first time '1' and when you refresh
combox value are not show in a JSP - JSP-Servlet
combox value are not show in a JSP  i have a combo box in a JSP after submit it does not show its value in logic.jsp Home.jsp: <...;/option>"); } %> logic.jsp: at run time logic.jsp
ModuleNotFoundError: No module named 'show-current-time'
ModuleNotFoundError: No module named 'show-current-time'  Hi, My... named 'show-current-time' How to remove the ModuleNotFoundError: No module named 'show-current-time' error? Thanks   Hi, In your
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
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
JSP Date & Time - JSP-Servlet
JSP Date & Time  Hi! How to compare a String with System time in JSP.... pls... help me... Thanks in advance
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.
Dirty page and Dirty report
Dirty page and Dirty report  hiii, Explain dirty page and dirty report?   hello,ADS_TO_REPLACE_1 Dirty Pages: Data that which is modified and Stored in the buffer cache but has not yet been written
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
Create Web Page with jsp
the current date/time for display on JSP page.  Start the tomcat server, open... Web Page with jsp       In this example we will show you how to create first web page on tomcat
How to Create JSP Page
How to Create JSP Page       In this section we will show you how you can create JSP page and then test... can be used. In this example I will show you how to create a simple JSP page
Show pdf's in web browser by using jsp?
Show pdf's in web browser by using jsp?  Hi, I want to display pdf file in browser by clicking the link, available in JSP page. When am trying... status - 404. How can i resolve it in JSP
generate graf report.. - JSP-Interview Questions
generate graf report..  How to generate report(graf) using jsp code
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
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
JSP handle run-time exceptions
JSP handle run-time exceptions  How does JSP handle run-time exceptions?   You can use the errorPage attribute of the page directive... the browser to the JSP page error.jsp if an uncaught exception is encountered during
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
Time display - JSP-Servlet
Time display   In a web application or ina website if we display the time getting as system time, whether it is server' system time or client' system time. Is there any difference between getting time using java Date
report generation
report generation  i need to show the report between two dates in jsp is it possible
ModuleNotFoundError: No module named 'odoo10-addon-hr-attendance-report-theoretical-time'
;odoo10-addon-hr-attendance-report-theoretical-time' error? Thanks  ... can install odoo10-addon-hr-attendance-report-theoretical-time python with following command: pip install odoo10-addon-hr-attendance-report-theoretical-time
ModuleNotFoundError: No module named 'odoo10-addon-hr-attendance-report-theoretical-time'
;odoo10-addon-hr-attendance-report-theoretical-time' error? Thanks  ... can install odoo10-addon-hr-attendance-report-theoretical-time python with following command: pip install odoo10-addon-hr-attendance-report-theoretical-time
ModuleNotFoundError: No module named 'odoo11-addon-hr-attendance-report-theoretical-time'
;odoo11-addon-hr-attendance-report-theoretical-time' error? Thanks  ... can install odoo11-addon-hr-attendance-report-theoretical-time python with following command: pip install odoo11-addon-hr-attendance-report-theoretical-time
ModuleNotFoundError: No module named 'odoo12-addon-hr-attendance-report-theoretical-time'
;odoo12-addon-hr-attendance-report-theoretical-time' error? Thanks  ... can install odoo12-addon-hr-attendance-report-theoretical-time python with following command: pip install odoo12-addon-hr-attendance-report-theoretical-time
ModuleNotFoundError: No module named 'odoo12-addon-hr-attendance-report-theoretical-time'
;odoo12-addon-hr-attendance-report-theoretical-time' error? Thanks  ... can install odoo12-addon-hr-attendance-report-theoretical-time python with following command: pip install odoo12-addon-hr-attendance-report-theoretical-time
ModuleNotFoundError: No module named 'odoo12-addon-hr-attendance-report-theoretical-time'
;odoo12-addon-hr-attendance-report-theoretical-time' error? Thanks  ... can install odoo12-addon-hr-attendance-report-theoretical-time python with following command: pip install odoo12-addon-hr-attendance-report-theoretical-time
ModuleNotFoundError: No module named 'odoo13-addon-hr-attendance-report-theoretical-time'
;odoo13-addon-hr-attendance-report-theoretical-time' error? Thanks  ... can install odoo13-addon-hr-attendance-report-theoretical-time python with following command: pip install odoo13-addon-hr-attendance-report-theoretical-time
JSp taking time to processs - JSP-Servlet
JSp taking time to processs  Hi, I am creating an vxml thro' jsp for IVR application. All jsp's are working fine. But one them is not working properly. Its taking long time to process. Even at my side i could not see logger's
JSP error page - JSP-Servlet
JSP error page  Hi i have 1000 of JSP. but we coded it without adding the . but now i have to forward the page to the specific page when the exception occured in JSP. is there any short cut i can do? do not want to add this line
JSP date example
, now I will show you how to create a simple dynamic JSP page that prints... In the JSP Declaratives  <%@page contentType="text/html"... JSP date example      
JSP hide and show tables
JSP hide and show tables In this tutorial, you will learn how to hide and show html tables using javascript in jsp. Here is an example of simple jsp code..., table will be visible with all the data. Example: <%@page language
jsp page - JSP-Servlet
jsp page  what are elemets and template data in jsp page??  Hi Friend, Template Data is a parameterized content that allows the JSP document to generate a response stream of characters. JSP Elements provides

Ads