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! See 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 Servlet?
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.