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

 
 


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

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 Pages:
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
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
report generation
report generation  i need to show the report between two dates in jsp is it possible
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
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
J2ee Crystal report integration
is very high when making report in jsp(Handling dynamic sql queries,page...J2ee Crystal report integration  Hai Sir, I am familiar with crystal report and vb6 and sql server 2005.Now i want to integrate crystal report
time
?   Here is a jsp example that fetch the time from the database and display in different format. <%@page import="java.sql.*"%> <%@page import...time format hh:mm:ss  Hi. I have retrieved time from mysql database
time
?   Here is a jsp example that fetch the time from the database and display in different format. <%@page import="java.sql.*"%> <%@page...time display only as hh:mm.  Hi. I have retrieved time from mysql
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
time
is a jsp example that fetch the time from the database and display in different format. <%@page import="java.sql.*"%> <%@page import="java.util.*"%>...time  Hi. I have retrieved time from mysql database. its in th format
time
is a jsp example that fetch the time from the database and display in different format. <%@page import="java.sql.*"%> <%@page import="java.util.*"%>...time  Hi. I have retrieved time from mysql database. its in th format
time
. wat to do?   Here is a jsp example that fetch the time from... is a jsp example that fetch the time from the database and display in different...retrieved time from mysql database  Hi. I have retrieved time from
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
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
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 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
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
dynamic report
dynamic report  i need complete code for generating dynamic report in jsp
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
report problem
report problem  I have made a project that displays charts using... such project report,then do soon,..Its urgent.   Please visit the following link: http://www.roseindia.net/jsp/draw-statistical-chart-jsp.shtml
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
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
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
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
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
how to print the server time
how to print the server time  how to print the server time in jsp and update time in fix interval
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
Display current time using jQuery & JSP
Display current time using jQuery & JSP In this Tutorial we will develop a Html page which displays current date and time using jQuery and JSP.This Html page contains jQuery which calls JSP page to add date in the web page
date_interval_create_from_date_string
( string $time ) Parameters of date_interval_create_from_date_string() PHP time...date_interval_create_from_date_string date_interval_create_from_date_string alias DateInterval::createFromDateString is used for setting up a DateInterval
how to show hyperlink website on the same page
how to show hyperlink website on the same page  dear sir: i need to know how can you show a webiste on the same page. for example i want to show... on the same page weather it is left aligned or right. i read somewhere that you
time decrement
time decrement  i want to know calculate the time for 2 minutes(from current time started),after that the button in the page will be disable  ... minute. You can increase time interval as per your requirement. <!DOCTYPE HTML
report making in asp
report making in asp  Hi sir, Please give some example report making code for jsp and mysql
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
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
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
Absence data Report
Absence data Report  Absence data Report - The report will detail the absences for the employee, and will move to a new record after completing all details for the specific employee. Using SQL commands and HRMS Tables  
Join tables in the specific database
Join tables in the specific database   ... or database is a very time consuming. So, what the alternative to that, divide... two or more tables in a specific database. For this you need to have two
JavaScript Show Date
JavaScript Show Date... in the given example, we have created Date object which holds the current date and time... the current date. Here is the code: <html> <h2>Show
crystal report plugin for eclipse
crystal report plugin for eclipse  Hi, I want to know whether unicode based crystal reports can be generated using jsp.?Also I need the crystal report plugin for eclipse . Thanks
time
time  sir, i want to show system time on a textfield in awt(java). woulk you send me an example of time which can show time in standard format like H:M:S pls help me sir   Display time in JTextField import
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
Locale Specific Date validations through JavaScript/Ajax...
JSP Page, when the user selects language(It may be Chinese or French or etc... about using cookies in JSP at JSP Cookies Example tutorial page. Thanks...Locale Specific Date validations through JavaScript/Ajax...  Hi, I
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
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.
generate graf report.. - JSP-Interview Questions
generate graf report..  How to generate report(graf) using jsp code

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.