I'm new to
struts, can anyone advise how I could achieve the following functionality.
I have a requirement to add a new [Save and Print] button function to a
JSP in my struts app. This functionality is required to save the current form and then launch a pdf for printing. Both these functions already exist separately and this requirement is designed to perform both operations in one click. The question I have is how can I get the 2 fumctions to run sequentially, i.e. finish save and then launch pdf. In my new saveAndPrint() js function I call the save() function and then return to launch a modal window in which a JasperReports pdf is produced.
The problem is the print method on the action class executes before the save has completed and therefore the model classes that store the data from the backing form do not reflect the changes to the form and I cannot re-extract the data as it has not yet been assigned an Id from the database.
I tried adding a setTimeout prior to calling the print action method however it never gets triggered, is this because the form has been submitted as part of the save?