Jasper Reports using JAVA
1.What?
Third party tool use to report content in a software.
Eg:JAVA->jasper report
C#->Crystal report
2.Purposes of Jasper Report?
Print report:
Export File(Eg;-pdf,excel)
Report in Screen or display
3.Mandatory component?
Must specify "data source(data adapters)" like data base.
4.steps of create a jasper report.
Eg:
//Design
File JasperDesignFile = new File("your jrfxml file path");
JasperDesign JasperDesign = JRXmlLoader.load(JasperDesignFile);
//compile
JasperReport jasperReport = JasperCompileManager.compileReport(JasperDesign);
//execute
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap<>(), new JREmptyDataSource());
//export
JasperViewer.viewReport(jasperPrint);
5.In which step jasper report get data from "fill manager"?
In execution step
6.Why use Jasper studio.
to generate .jrxml files easily using GUI drag & drop
7.which kind of sw. use for connect user app .jrfxml file
Jasper report library
8.Which kind of Archive file can make using java.
a.jar-java archive(Official Site ,official web to download )
b.war-web archive
c.ear-enterprise archive
10.what does java mean "class path(cp)"
Classpath is a parameter in the Java Virtual Machine or the Java compiler that specifies the location of user-defined classes and packages.
11.what actually jvm run when run "java AppInizializer"
java -cp .AppInizializer(. specify current path)
11.when run "new File", is it out put new file?
No.Its create an Object pointer.
12.There is a file in your computer called A in your C drive & there is another file calle B inside your A drive.There is a AppInizializer.class main file in your B folder & there is a file called Student.java file & AppInizializer.class call method in Student.java file,how you run that without changing file locations
go inside "C:\A\B\"
java -cp .;C:\A AppInizializer
13.What do you mean by Resources in java
any file in the project except .class files.
14.explain deference's between Internal resources & external resources in java program.
Internal resources | External resources |
file inside the artifact(Product) | This file do not inside the artifact.But project will depend on this. |
eg: inside jar file | eg: outside jar file |
There are 2 two type of method to use internal resources & you must use relative path method for this URL(you can't use absolute path method for this resources.) (a)Inside the static method "class name".class.getresource() "class name".classetResourceAsStream() Eg: AppInizializer.class.getResourceAsStream() (b)Inside the Non-static method this.getClass.getResource() | There are are two way of using this Using "new File()" object pointer Relative path (If resource is in the outside the module but inside the project,we can use this method) Absolute path(path can be any location but must specified location):(non recommended method in most cases) |
Deploy product without using external resources. | Must use external files |
Hard customization | Easy customization |
Used in Static Jasper report purposes. | Used in dynamic Jasper report purposes. |
15. Deferences between Jasper parameters,Fields,variable?
Parameter map or maps with different settings for your report. Usually it is similar to user inputs to report.
parameters.put("ItemCode", Item); //where ItemCode is a parameter you have created in your JRXML template.
Eg-Enter query as parameter($P{query})
Fields are used where data changes frequently.Fields are populated from the JasperReportDataSource.
Eg-Item name in pos bill($F{item_name})
Variables used to calculate to some calculation in the reports.
Eg:-Net total in the pos bill($V{NetTotal}.setScale(2).toPlainString())
You want to rebuild the project after doing changes in Jasper project,It may course to avoid some exception.
Comments
Post a Comment