This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
I need to build an in-memory Dynamic XHTML and pass it on to itext API to convert that XHTML to PDF. Data to be inserted in that in-memory HTML tags will come from a web-service or maybe a thirparty API.

So, 2 things I need help with is

1. How to generate Dynamic XHTML without using out.println("") in
2. What is best way to populate data from web-service into Dynamic XHTML tags?

I already have a working prototype wherein a Java class returns StringBuilder object which has XHTML (but its all hard coded "Hello World" kind of HTML) and that StringBuilder object is converted to ByteArrayInputStream and given to DocumentBuilder and finally to iText API to convert to PDF.

We want to design this in a fashion so that we can re-use same architecture down the road to generate any PDF.

Thanks for help in advance.

Author and ninkuma
Posts: 66424
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might consider an approach using filters and a response wrapper if you want to leverage JSP. (Yeah, I'm a manager -- I can use words like leverage.)

Or you might consider a templating engine such as FreeMarker.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!