Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting an action method to run only after another action method completes

 
Willy Wonka
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
Sriram Ture
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Dont do the check on client side, do it on server side.


Regards,
Sriram
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see the JavaRanch naming policy and change your display name to conform with this policy. Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic