CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge -> Programming

 How to call JasperReports from JSP page..

Print topic Send  topic

Author Message
Bhaskar
Posted: 11/25/2004, 11:02 PM

Hi

I have a problem relate to jasper report, i have tried some solutions but i 'm still not solve this problem.
It's a web application, i used iReport, tomcat 5.0 integrate in Eclipse. When I call Report from JSP page, in output I am getting null values only.

I can't understand, actually where is the problem.
If anyone may knows that solution, please replly immediately to "kbr_java@rediffmail.com".

Thanks and Regards
Bhaskara Rao
Ram Mohan
Posted: 04/06/2005, 12:22 AM

We have gone thru your query and we too facing the similar problem. Had you solved your problem? If so, we will verymuch thankful if you can
guide us for the same.

Thanks in advance.

Regards,
Ram Mohan
Dan
Posted: 06/03/2005, 8:59 AM

:(
I am a total clueless newbee to jasper and Ireport, does anyone have a very simple example of sending a .jasper report in CCS I am using jboss-Jetty

Thanks in advance
Dan
vijay
Posted: 06/22/2005, 11:22 AM

hi bhaskar

i dono how to access ireport from jsp . am using tomcat4.1 server. can u help me to solve this problem . pls.

thanks


vijay
Santhosh
Posted: 06/24/2005, 3:10 AM

Hi Bhaskar,

how to integrate Jasper Reports in a web application.required jars ,procedure,any configuartion files etc
As you have gone thru the above procedure,please let me know the
details for integrating JR.

thanks
santhosh
Jasferdz
Posted: 06/28/2005, 7:45 PM

Hi!
Can u help me in my problem in how to connect my jasper reports design from JSF(GUI) to the postgres database. Im using Spring, Tomcat 5, Postgresql. May i know the configurations if any.

Regards;
Jasferdz
netanel
Posted: 07/16/2005, 1:39 PM

it's says in the jasper report website that u have to set a variable that will define the class path of the jasper report libs and iText lib and etc...
look at how-to in their site
rizts
Posted: 08/01/2005, 11:38 PM

Hello all,

I also have a problem with my report
I use i-Report for reporting, but hte result can't be displayed if the records over a hundred, please help me .....
sachin
Posted: 08/06/2005, 2:03 AM

I am a total clueless newbee to jasper and Ireport, does anyone have a very simple example of sending a .jasper report in CCS I am using jboss-Jetty

thanks,
Sachin
madan kannan
Posted: 08/31/2005, 4:23 AM

how to integrate Jasper Reports in a web application or use iReport in web application plzz help me
Daniel
Posted: 09/13/2005, 6:39 AM

Hi everyone, I think you should use the documentation of Jasper Reports, it has good examples for a Web Applications

jasperreports-1.0.2-project.zip (Unzip it )

(where you extract it)\)jasperreports-1.0.0\demo\samples\webapp

Then copy webapp to webapps(If you're using tomcat), and see the examples, Im newbie too, but the examples help so much.

Enjoy it.
lalal
Posted: 09/28/2005, 7:04 AM

Hi,

I found a problem regarding to using jasper 1.0.0 above through tomcat intergrated with eclipse, as show below:

ava.lang.ClassCastException at
org.apache.commons.digester.SetNestedPropertiesRule.body(SetNestedPropertiesRule.java:261)

Anyone has an idea ?
Thanks.







Jagadesh
Posted: 10/17/2005, 6:10 AM

Hi,

I am facing the problem of integrating iReport-1.0.2,Eclipse-3.0 and Tomcat-5.0. Please let me know if any one knows.

Thanking U,

Jagadesh Kumar
Ashish Joy
Posted: 10/18/2005, 11:54 AM

Check out this article .. this guy has some good links to tutorials

http://www.tsproviders.com/techytrends/mvnforum/viewthread?thread=240

-Ashish
ikuyuldar
Posted: 12/27/2005, 12:18 AM

i have the problem as lalal has, just the same..
lalal if u have figured out that problem, please help me how to do..

java.lang.ClassCastException
at org.apache.commons.digester.SetNestedPropertiesRule.body(SetNestedPropertiesRule.java:261)
at org.apache.commons.digester.Digester.endElement(Digester.java:1006)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
ikuyuldar
Posted: 12/27/2005, 5:38 AM

:-<:-<
Hi lalal,
if solved your problem please tell me how to do?
my email:isa.kuyuldar@chenoa.com.tr


Thanks
sam
Posted: 01/10/2006, 6:10 PM

hie there..i'm new with ireport and jasperreports as well..i'm letting user to make selection of options available in the web application with my report..example user might want name and address of customers to be appearing on the report..may i know how do i get to do this?which is configuring how from getting the response from web application responding to the ireport?Thanks.
srikanth
Posted: 02/04/2006, 4:31 AM

Quote lalal:
Hi,

I found a problem regarding to using jasper 1.0.0 above through tomcat intergrated with eclipse, as show below:

ava.lang.ClassCastException at
org.apache.commons.digester.SetNestedPropertiesRule.body(SetNestedPropertiesRule.java:261)

Anyone has an idea ?
Thanks.








srikanth
Posted: 02/04/2006, 4:32 AM

I too have same problem
if u find result plz then sent to me
bye
srikanth.



Quote lalal:
Hi,

I found a problem regarding to using jasper 1.0.0 above through tomcat intergrated with eclipse, as show below:

ava.lang.ClassCastException at
org.apache.commons.digester.SetNestedPropertiesRule.body(SetNestedPropertiesRule.java:261)

Anyone has an idea ?
Thanks.








srikanth
Posted: 02/04/2006, 4:59 AM

I too have same problem
if u find result plz then sent to me
bye
srikanth.



Quote lalal:
Hi,

I found a problem regarding to using jasper 1.0.0 above through tomcat intergrated with eclipse, as show below:

ava.lang.ClassCastException at
org.apache.commons.digester.SetNestedPropertiesRule.body(SetNestedPropertiesRule.java:261)

Anyone has an idea ?
Thanks.








Naga Srikanth
Posted: 02/05/2006, 9:45 PM

Hi,


I successfully compiled my program when I am trying to execute the code
and it is giving the following error
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester

After I am adding commons-beanutils.jar
common-digester.jar
common-utils.jar
jasperreports1.1.1.jar
then It is giving
the following error saying that

No class Found Exception org/apache/common/digester/Digester/setNestedPropertiesRule
not found


Any one Have idea,,plz sent to me


Thanks in advance.,


Bye.
M. Naga Srikanth,
Ameerpet.
Hyderabad

M.N.Vani Srikanth
Posted: 02/06/2006, 10:38 PM

:-) :-) :-) :-) :-@ :-P

HI

I competed .jrxml by the iReport1.0., but now should i call it from a JSP
page and what is the directory structure i have to maintain what is the default jar
file that i have to include i dont know.
Any Idea.,
then sent to me


Vani Srikanth.M.N
l
rakesh
Posted: 02/09/2006, 1:31 AM

:-) plz send a sample jsp file to display jasper reports in jsp .
my mail id is rakesh_2003_4u@yahoo.com
s
Posted: 02/09/2006, 1:32 AM

:*) :-{} :-( :-) :( :-D 8-) :*) :-/ :-{} :-X :-O :-@ O:) :-P :-< :-( :-|
jhsp.jspservlet
seema
Posted: 02/14/2006, 9:48 PM

Quote madan kannan:
how to integrate Jasper Reports in a web application or use iReport in web application plzz help me
Quote :
Hi, Iam facing problem to generate reports in java. Iam using jsp, tomcat5. and I just wana to know which tool is more easier to generate reports.I f any one know plz solve this problem.
Seema
naga srikanth
Posted: 02/17/2006, 3:50 AM

:-D
I completed jasper reports integration in a web application
if you need any queries just send a mail to my mail
that isnagasrikanth2@gmail.com
.............................

After developing a .jrxml file using iReports that is reporting open source
after that just you copy this file and place into the WEB-INF folder
after that just copy the all the jar files from the tomcat
and place into the lib folder after that
just you place the following code into the your servlet file
then it will automatically creates the reports
regarding your need i.,e., (xm,html,word,csv,xls,pdf)
import java.util.*;
import net.sf.jasperreports.engine.*;
import java.io.*;
import java.sql.*;
import net.sf.jasperreports.view.*;
import net.sf.jasperreports.view.save.*;

public class mybean
{
Statement stmt1;
Connection con1;
JasperReport jasperReport;
JasperPrint jasperPrint;
JRResultSetDataSource obj;
ResultSet rs3;
String i,j;
String salarys,salarye,butValue1;
String pdftext,csvtext,htmltext,xmltext,exceltext,wordtext,path;

public void setSalarys(String salarys)
{
this.salarys=salarys;
}
public void setSalarye(String salarye)
{
this.salarye=salarye;
}
public String getSalarys()
{
return salarys;
}
public String getSalarye()
{
return salarye;
}
public void setbutValue1(String butValue1)
{
this.butValue1=butValue1;
}
public String getbutValue1()
{
return butValue1;
}
public void setPdftext(String pdftext)
{
this.pdftext=pdftext;
}
public void setHtmltext(String htmltext)
{
this.htmltext=htmltext;
}
public void setXmltext(String xmltext)
{
this.xmltext=xmltext;
}
public void setCsvtext(String csvtext)
{
this.csvtext=csvtext;
}
public void setExceltext(String exceltext)
{
this.exceltext=exceltext;
}
public void setWordtext(String wordtext)
{
this.wordtext=wordtext;
}
/////////
public String getPdftext()
{
return pdftext;
}
public String getHtmltext()
{
return htmltext;
}
public String getXmltext()
{
return xmltext;
}
public String getCsvtext()
{
return csvtext;
}
public String getExceltext()
{
return exceltext;
}
public String getWordtext()
{
return wordtext;
}



/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void dataOut()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con1=DriverManager.getConnection("jdbc:odbc:abcDSN","root","");
stmt1=con1.createStatement();
rs3=stmt1.executeQuery("select *from info where salary>"+salarys+" AND salary<"+salarye+"");

obj = new JRResultSetDataSource(rs3);
jasperReport = JasperCompileManager.compileReport("C:/Documents and Settings/srikanth/Desktop/vani/WEB-INF/simple2.jrxml");
jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(),obj);

}catch(Exception e){System.out.println(e);}
}
public String genPdfReport()
{

try
{
JasperExportManager.exportReportToPdfFile(jasperPrint,"C:/Documents and Settings/srikanth/Desktop/"+pdftext+".pdf");
System.out.println("your file updated to pdf file plz check pdf file on desktop");
path="C:/Documents and Settings/srikanth/Desktop/"+pdftext+".pdf";
}catch(Exception ee){System.out.println(ee);}
return path;
}

public String genHtmlReport()
{
try
{
JasperExportManager. exportReportToHtmlFile(jasperPrint,"C:/Documents and Settings/srikanth/Desktop/"+htmltext+".html");
System.out.println("your file updated to HTML file plz check pdf file on desktop");
}catch(Exception eee){System.out.println(eee);}
path="C:/Documents and Settings/srikanth/Desktop/"+htmltext+".html";
return path;
}
public String genXmlReport()
{
try
{
JasperExportManager.exportReportToXmlFile(jasperPrint,"C:/Documents and Settings/srikanth/Desktop/"+xmltext+".xml",true);
System.out.println("your file updated to XML file plz check pdf file on desktop");
} catch(Exception eeee){System.out.println(eeee);}
path="C:/Documents and Settings/srikanth/Desktop/"+xmltext+".xml";
return path;
}
public String genExcelReport()
{
try
{
JRSingleSheetXlsSaveContributor excelobj = new JRSingleSheetXlsSaveContributor() ;
File f1 = new File("C:/Documents and Settings/srikanth/Desktop/"+exceltext+"");
excelobj.save(jasperPrint,f1);
}catch(Exception eeeee){System.out.println(eeeee);}
path="C:/Documents and Settings/srikanth/Desktop/"+exceltext+".xls";
return path;
}
public String genWordReport()
{
try
{
File f2 = new File("C:/Documents and Settings/srikanth/Desktop/"+wordtext+"");
JRRtfSaveContributor rtfobj = new JRRtfSaveContributor();
rtfobj.save(jasperPrint,f2);
}catch(Exception eeeeee){System.out.println(eeeeee);}
path="C:/Documents and Settings/srikanth/Desktop/"+wordtext+".doc";
return path;
}
public String genCsvReport()
{
try
{
File f3 = new File("C:/Documents and Settings/srikanth/Desktop/"+csvtext+"");
JRCsvSaveContributor csvobj = new JRCsvSaveContributor();
csvobj.save(jasperPrint,f3);
}catch(Exception eeeeeee){System.out.println(eeeeeee);}
path="C:/Documents and Settings/srikanth/Desktop/"+csvtext+".csv";
return path;
}
public String getPath()
{
return path;
}



}
naga srikanth
Posted: 02/17/2006, 3:52 AM

:-D
The above code will help to you,
thanks for forums.codecharge.com

this opportunity if you need any queries regarding Jasper reports with integrating web applications just send a mail for you get answer
thank you,.,
bye

mr(naga srikanth)(vani srikanth)
venkat
Posted: 02/27/2006, 4:17 AM

while compiling the jrxmlfile by the server ,its throughing exceptions that its not taking hte jasper reports jarfile in the class path but the jar file is there in the lib .

can u send me any sample file having integrated with servlet
Ly Duc Doan
Posted: 03/08/2006, 1:51 AM

The viewer:
package com.jaspertest.web;

import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import com.dbdh.util.*;
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.view.*;
import net.sf.jasperreports.view.save.*;

/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>

* This is shown how to load the Jasper report from web application.
*/

public class ReportView extends JFrame {
private JPanel contentPane;
private BorderLayout borderLayout1 = new BorderLayout();
public ReportView(String[] args) {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit(args);
} catch (Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit(String[] args) throws Exception {
DesEncryptor encrypter = new DesEncryptor("idnhswtwtcentf8");
String reportName = "";
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
this.setSize(new Dimension(670, 800));
this.setTitle("Frame Title");
//Set JDBC driver: note: by runing the jasper in web application.
//The ReportViewer at client must access to the Mysql Server
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection con1 = DriverManager.getConnection("jdbc:mysql://MYSERVER:3306/MyDB", "User", "Pwd");
//From client, get the report over HTTP, the arg passed over jnlp by param 0, arg 1 is report name to request.
java.net.URL u = new java.net.URL(args[0] + "report/" + args[1]);
JasperReport template = JasperManager.loadReport(u.openStream());
//Prepare parameters to pass over the Jasper
java.util.Map parameters = new java.util.HashMap();
//We passed param of arg 3 as passed from jnlp.
parameters.put("SOMEVAL", args[2]);
JasperPrint report = JasperManager.fillReport(template, parameters, con1);
//Start the viewer
JRViewer jrv = new JRViewer(report);
jrv.show();
contentPane.add(jrv);
contentPane.setPreferredSize(new Dimension(670, 800));
contentPane.show();
}

//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}

public static void main(String[] args) {
try {
ReportView frame = new ReportView(args);
frame.validate();
frame.setLocation(100, 100);
frame.setVisible(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
-------------------

This ReportView then will be packaged in to a jar file named: reportviewer.jar and placed under webapp context.

We will then using javaweb start to run this reportviewer application. please refer to this for more detail.

http://java.sun.com/developer/technicalArticles/Programming/jnlp/

/*
Generate the jnlp file, saved in the web context of the web project.
suppose we saved it to c:\tomcat5\webapps\JasperTest\tmp\TestReport.jnlp
*/
private void ExportJNLP(String jnlpFile) throws Exception{
File f = new File(jnlpFile);
FileWriter fw = new FileWriter(f, false);
fw.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fw.write("<jnlp spec=\"1.0+\"\n");
fw.write("codebase=\"http://MYSERVER:8080/JasperTest/\"\n");
fw.write("href=\"tmp/TestReport.jnlp\">\n");
fw.write("<information>\n");
fw.write("<title>Reporting Utility.</title>\n");
fw.write("<vendor>Your Title here.</vendor>\n");
fw.write("<description>Description goes here</description>\n");
fw.write("</information>\n");
fw.write("<security> \n <all-permissions /> \n </security> \n");
fw.write("<resources>\n");
fw.write("<j2se version=\"1.4+\"/>\n");
fw.write("<jar href=\"reportviewer.jar\"/>\n");
fw.write("</resources>\n");
fw.write("<application-desc main-class=\"com.jaspertest.web.ReportView\" >\n");
//Pass arguments in to the report.
fw.write("<argument>http://localhost:8080/JasperTest</argument>\n"); // args[0]: The server location where jasper template saved.
fw.write("<argument>Studen.jasper</argument>\n"); // the report template name
//pass other argument
fw.write("<argument>some other argument</argument>\n"); // the report template name
fw.write("</application - desc >\n");
fw.write("</jnlp>\n");
fw.flush();
fw.close();
f = null;
}
------------------------------------------------------
Ly Duc Doan
Posted: 03/08/2006, 1:53 AM

If anyone have problem. Don't hesitate to email me at:lddoan99@yahoo.com. I might not be back here so dunno if anyone need futher assist.

I will be gladly to help!

Regards
Doan
 Page 1 of 2  Next Last


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.