Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2009
    Posts
    21
    Rep Power
    0

    Default how to call Java Bean Ireport frm Java application

    hi,
    I make one ireport using Java bean datasource it is run fine in ireport now I want call this report from Java application.
    please help me
    Thanking you
    Prashant

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    That is a very easy thing to do.
    Just get the jasperreports.jar file, add it to your class path and create a report using

    Java Code:
    JasperPrint print = JasperFillManager.fillReport(fileName, parameters, connection);
    JRViewer viewer=new JRViewer(print);
    fileName is the name of your .jasper file, parameters is a HashMap of the parameters required by your report.
    JRViewer extends JPanel so you should know how to display it from there on.

  3. #3
    Join Date
    Aug 2009
    Posts
    21
    Rep Power
    0

    Default

    Quote Originally Posted by r035198x View Post
    That is a very easy thing to do.
    Just get the jasperreports.jar file, add it to your class path and create a report using

    Java Code:
    JasperPrint print = JasperFillManager.fillReport(fileName, parameters, connection);
    JRViewer viewer=new JRViewer(print);
    fileName is the name of your .jasper file, parameters is a HashMap of the parameters required by your report.
    JRViewer extends JPanel so you should know how to display it from there on.
    Thanks for reply but I fill my report using bean objects not by Database connection so I m confusing how can my java Application know from which java bean data has to displayed to Pdf.
    plz help me
    Thanking You
    Prashant

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    So don't pass the connection. The fillReport method has lots of overloads.

  5. #5
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Does your data bean extend a class that implements JRDatasource?

  6. #6
    Join Date
    Aug 2009
    Posts
    21
    Rep Power
    0

    Default

    Quote Originally Posted by r035198x View Post
    So don't pass the connection. The fillReport method has lots of overloads.
    Thats what I am asking what I pass there in hat Argument , I just want to know how my application know that which sepecific jar file (bean file) get the Data for filling report

  7. #7
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    One approach is to make your class a JRDatasource. You could extend some of the already implemented classes. Read the API specs for all those classes and interfaces to see how to use them.

  8. #8
    kalyan755 is offline Member
    Join Date
    Jul 2010
    Posts
    1
    Rep Power
    0

    Default

    Prashanth,

    I am in same situation like you. Can you please provide me the solution for this problem if you have one?

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

Similar Threads

  1. how toi make Java Bean DataSource connection in ireport
    By Prashant.surwade in forum Advanced Java
    Replies: 17
    Last Post: 12-18-2009, 07:53 AM
  2. how to call dll from java ??
    By Omarero in forum New To Java
    Replies: 3
    Last Post: 11-13-2008, 05:14 AM
  3. Java sdk 6 + iReport-nb-3.1.0 + JasperReports 3.0.1
    By fleahlit in forum New To Java
    Replies: 0
    Last Post: 08-20-2008, 10:08 AM
  4. how to call a dll from java
    By katie in forum Advanced Java
    Replies: 3
    Last Post: 12-10-2007, 10:34 AM
  5. xml to java bean
    By Peter in forum XML
    Replies: 2
    Last Post: 07-04-2007, 01:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •