Tuesday, August 28, 2012

Declarative Component in Oracle ADF (To Generate the PDF/CSV/XML/HTML type of report) Part 2

Generating PDF/HTML/CSV/XML Report in ADF :

"You can clone source code from git hub and below is address "


In my  last past i have explained how to generate report into PDF format.But that component is not able to generate report in HTML/CSV/XML.(Limitation )

Hence in this post i have tried to resolved all the problem which last version has. Using this you can generate report following new format .


Declarative Component Specification(ReportDeclarative ) :

Tag-Lib Name :reportDeclarative
Tag-Lib-URL: http://www.adfwithejb.blogspot.com
Tag-Lib-Prefix :report
Component Name :ReportDeclarative

*All i have changed the Tag-Lib information .

Attribute of the ReportDeclarative  component  are following  :

S.No. Attribute Name Required Default Value Explanation
1 Button Name Yes
It will display as button name of download button
2 Report Type Yes
1-For Pdf Report :PDF
2-For Csv Report :CSV
3-For Html Report :HTML
4-For XML Report :XML
3 Report Name Yes
Name of the report.it does not require any extension
4 Table Id Yes
af:table id which you want to export into pdf 
5 Serial Number
False It will add one column in the table which contains serial number
6 Pagination No False Pagination in pdf.It will only applicable when report type is pdf.
7 Row Tag No
If you generating  XML report then it is required
8 Parent Tag No
If you generating  XML report then it is required
9 Serial Column Header No S.No. If you are generating report with serial number then by default column header will be S.No. If you want to change then you can replace it  here.

Following Feature added in this version which were not presented  in last version .

1-Exception handling is implemented
2-Pagination is implemented
3-Serial Number
4-XML Report Support
5-HTML Report Support
6-CSV Support
7-Region Support
   You can use this component in Region as well .

Since only pdf report  require itext  API so do not forget to add itext jar file in project  which is present at following link.


Download component jar at following line :

(This time i have been uploaded file in google document  )

* I have already mentioned in  my last how to add declarative component jar in the project. 

I tested this with multiple scenario and it is working for me.Please let me know if you will get any type of exception or error.

PDF Report:
 *You can generate pagination
 *You can add serial number and you can change serial column header by default will S.No.

CSV Report :
  *CSV file contains comma separate value.
  *So if you are using Open office then you have to check separate by comm .
  *Pagination is not applicable
  *You can add serial number and also you can change the default serial column header value.
  *It is same as note file hence Header will not come as bold . 

HTML Report :
*You can add serial number and also you can change the default serial column header value.
*Pagination is not applicable 

XML Report :
*Column name will come as opening tag and closing tag.
*You need to provide parent tag of the column in Raw Tag attribute of the declarative component
*All the parent tag should also have parent therefore you also need to provide parent tag value in Parent Tag attribute of the declarative component.
*No pagination will work .

Any comment will appreciated .



  1. many thanks for this great component
    but there is an issue when I test this component
    OS: Windows7
    Jdev Ver:
    Issue: I must press button two times in order to generate report.
    when I press it for the first time it still loads but no report is generated.

    1. Hello Ahmed ,

      This is not problem with component.I think you did not have af:form in your page or might be component not inside in af:form.

      Since i already faced the same problem and it resolved after putting the component inside in the af:form .

      Please let me know your experience.


  2. god jab and i now that i itext is using a PDF file as a template i was tring that in V 5.1.3 are it`s can be use to ad the template pdf file url as one of the component parameter

  3. i like to ask you if you can send me the source of the Component

  4. sure ,

    Can you send me your email id address ?


    1. Hi Prateek,

      Thanks for such a useful reusable library, can u pls share the code so that i can customize this to my requirement? :)


    2. Hi Prateek
      I also require this re usable declarative component library . Please send me source of this code at email address nisarg.doshi23@gmail.com

  5. i really would like to thank you this is such a generous offer you gave ,
    my mail is :

    thank you

  6. Hi Prateek ,

    Can you please send me the code . As i need to extend the same with few layout changes . can you please help me on this .

    Thank you,

  7. Hello Kumar ,
    Thank you for the gerat component, but I couldn't managed to work it . I added you library as to my project but still cannot find your component (reportDeclarative) in the component browser.

    In the log , it seems all went good wjile adding the linbrary to project.

    These ADF Library jar items are now in ViewController.jpr

    These are in the project as a result of your ADF jar imports:
    Itextpdf-5.1.0.jar (file:/C:/Dev/adf/mywork/declarativeComponents/itextpdf-5.1.0.jar from .../ReportAppsV2/ReportGeneration/ReportGeneration.jpr )

    Do you have any idea what can be the problem ?

    Also if it is possible may I have your code ?

    Best Regards,

  8. Hello Kumar ,
    I noticed that your component is for jsp pages. I want to use this on a JSF page.


  9. Hi Prateek,

    Your component works very well for JSP pages and it is not working in JSF page.Will you add or edit your component to support JSF also. Will you share me the source code.


  10. hi Prateek,

    Your Tutorial is very helpfull for us,

    If Possible Can you please send me the Compoenet code . As i need to extend the same with few layout changes like logos and Headers . can you please help me on this .

    My Email Id is: satishkumar0542@gmail.com

  11. Hi Prateek ,
    Great post! It's really helpful.Can you send me the source code for the same. Need some tweaks to use it.
    Please mail me at - shanto.mathew2011@gmail.com

  12. HIi Prateek,

    Its very useful thing , can u please send me the code with example so I can use it.

    My email id: ashishomenia2@gmail.com.

    thanks .

  13. Hi Prateek,

    Could you share me the code.. it's really helpful..

    Thanks in advance..

  14. Hi Prateek,

    Could you share me the code too.. it's really useful.. my email id : ajit_sri@hotmail.com


  15. Hi Prateek,

    Your blog is very useful. If possible, would you please share the source code also? My email id is jaga.griffins@gmail.com.