• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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


Regards,
Sriram
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please see the JavaRanch naming policy and change your display name to conform with this policy. Thanks!
reply
    Bookmark Topic Watch Topic
  • New Topic