Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

can anyone help me to send the code for Jasper Reporting in
java?plz

Answer Posted / ram

//this code is very easy any one can understand easily
//1. these are the packages which we need to import
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 net.sf.jasperreports.engine.design.JRDesignQuery;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.view.JasperViewer;

//2. this is the java code for developing reports

try{
Connection con=(Connection)
Connectivity.makeconnection();// Database Connection

File path=new File("Report/");
JasperDesign jasperDesign =
JRXmlLoader.load(path.getAbsolutePath()+"\\allbooksreport.jrxml");//here
allbooksreport is my jrxml file name ...//xml file

Map parameters = new HashMap();
parameters.put("DataSource" ,con);
JRDesignQuery query =new JRDesignQuery();
query.setText("select * from add_book");
jasperDesign.setQuery(query);
JasperReport jasperReport =
JasperCompileManager.compileReport(jasperDesign);
JasperPrint jasperPrint =
JasperFillManager.fillReport(jasperReport,parameters,con);
JasperViewer vwrpt = new
JasperViewer(jasperPrint,false);
vwrpt.show(); //...//view the report
vwrpt.setTitle("All Books Report");
} catch(Exception e) {
e.getMessage();
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of @beforeresult annotation?

959


List some struts tag libraries?

907


Why was reload removed from struts (since 1.1)?

932


Describe the mvc on struts?

913


What are the reasons for an error message not being displayed while developing struts application?

893


What is struts.devmode?

985


When do I need “struts.jar” on my classpath?

921


What is the difference between plain-validator and field-validator?

899


What is s token?

939


Which interceptor is responsible for mapping request parameters to action class Java Bean properties?

998


In which order struts framework searches for a message bundle?

889


What’s the difference between struts and espresso?

915


What types of validations are available in xml based validation in struts2?

969


Explain the difference between jakarta struts and apache struts?

897


What is meant by custom tags?

916