Christian - Many thanks for the quick response. The use case is that all of the data is stored in the database (there is actually no data input) .. the application is a case management system where there are a number of actors (Patient - the person who is having a service performed on them, Doctor - who is performing the service, Client - who is paying for the service, Patient Attorney, Client Attorney, Nurse, etc) .. there are a number of events such as an appointment is made, the patient did not show etc that require letters to be generated in the case of an appointment being made a letter to the patient confirming, a letter to the doctor, a letter to the client attorney etc. From looking at the example of the POIBean (code snippet below) , I thought this might be the answer .. but the example is currently failing and I have not been able to debug/ test (I will start another thread about this) .. and was also not sure why this was wrapped in a REST service .I have attached a sample of a letter ..
var lstBM = new java.util.ArrayList();
lstBM.add(poiBean.buildDocumentBookmark("name", sessionScope.name));
lstBM.add(poiBean.buildDocumentBookmark("address", sessionScope.address));
lstBM.add(poiBean.buildDocumentBookmark("zip", sessionScope.zip));
lstBM.add(poiBean.buildDocumentBookmark("location", sessionScope.location));
lstBM.add(poiBean.buildDocumentBookmark("e-mail", sessionScope.email));
var result = poiBean.processDocument2Stream(template, lstBM);