Skip navigation.
Home

ireport integration with jsp hep

i have a project in hand actually it is my first project in java and i dun know how to connect the jasperreport file jrxml with the jsp pages i have created and

when iam deploying the project how can i make it work and how can i configure the appache server 

ahmed adel

0103840145

Check that please

thx and i wanna more help

salamo 3likom

if u have an example i hope u can give it to me and also i hope u send me ur mob phone i wanna ask u about somthng else

0103840145

SA AhmedPlease check this

SA Ahmed

Please check this discussion http://forums.codecharge.com/posts.php?post_id=53893


Ahmed Hashim hashimblog/

thx i'll just try it

thx

i have problem

salamo 3likom

i have tried the code in the above link but i have following error

 

javax.servlet.ServletException: Servlet execution threw an exception

 

root cause

java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JRDataSource
	com.servlets.Go.per(Go.java:27)
	com.servlets.Go.doPost(Go.java:45)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

 

 

 

the servlet code

 package com.servlets;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 

 

import com.wrappers.GoGo;

 public class Go extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    
 public Go() {
  super();
 }    
 
private void per(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    
    
     GoGo g = new GoGo();
   
   g.dataOut();
     
   request.getRequestDispatcher("test1.jsp").forward(request,response);
   
  } 
 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  per(request,response);
 }   
 
 
 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  per(request,response);
 }          
}

the class code GoGo

 package com.wrappers;

import java.sql.DriverManager;
import java.util.HashMap;

import net.sf.jasperreports.engine.JRResultSetDataSource;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.ResultSet;
import com.mysql.jdbc.Statement;

public class GoGo {

 
 Statement stmt1;
 Connection con1;
 JasperReport jasperReport;
 JasperPrint jasperPrint;
 JRResultSetDataSource obj ;
 ResultSet rs3;
 String pdftext , csvtext , htmltext , xmltext , exceltext , wordtext , path;

 
 public GoGo() {
  super();
  System.out.println("hello");
  
 }
 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("com.mysql.jdbc.Driver");
   
    con1=(Connection) DriverManager.getConnection("jdbc:mysql://localhost/access","root","root");
    stmt1=(Statement) con1.createStatement();
    rs3=(ResultSet) stmt1.executeQuery("select * from items where");

    obj = new JRResultSetDataSource(rs3);
    jasperReport = JasperCompileManager.compileReport("C:/items.jrxml");
    jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(),obj);

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

}

so what can i do now if any one can call me coz i have to deliver that work so soon