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



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

Have Programming Question? Ask it here!
 
 
 


Anjali
JSP Page show report on specific time interval
1 Answer(s)      6 years and 5 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?  ... 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
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
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
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
report generation
report generation  i need to show the report between two dates in jsp is it possible
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 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
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
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
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
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 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
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 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
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
Iphone Show Current Date & Time
Iphone Show Current Date & Time In the previous examples, we have printed current date and time separately in iphone simulator. But in this example we are going to show you how to print both current date and current time in iphone
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
show, hide, disable components on a page with struts - Struts
show, hide, disable components on a page with struts  disabling a textbox in struts.. in HTML its like disable="true/false" how can we do it in struts
PHP Generate a pages loading time Tutorial
of time taken to load and display a specific page, for debugging or display purposes. To get the loading time of your page just put the following code at the top... PHP Page Loading Time      
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
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
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
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
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
dynamic report
dynamic report  i need complete code for generating dynamic report in jsp
Show mu;tiple DIV contents in a page
Show mu;tiple DIV contents in a page  Hi All; I want to show... boxes, i did that using function toggle(show... = 'none'; } if (show) { document.getElementById(show
Show Time in JSpinner Component
Show Time in JSpinner Component   ... of a JSpinner Component with time. Here, you will see time is increased... the time and change hour from 1 to 12. Following image shows you a JSpinner component
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
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      
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
Fetched Record from database show into text field of html page
is that if i have a report page with same four above filed and i type any letter...Fetched Record from database show into text field of html page  hi, i..., and also have html page with all above mentioned field i have submit 20 record from
jsp page
jsp page  <%@page contentType="text/html" pageEncoding="UTF-8"%>...;%@page import="java.sql.Statement"%> <%@page import="java.sql.DriverManager"%> <%@page import="java.sql.Connection"%> <%@page import
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
Advertisements
 

 

 

DMCA.com