See here http://cwiki.apache.org/WICKET/best-practices-and-gotchas.html#BestPracticesandGotchas-Startingdownloadafterformsubmission(Wicket1.1)

Federico Fanton wrote:
Hi everyone!
I have a form with some fields and a submit button which says "Save and print".
The button has setDefaultFormProcessing(false), and overrides onSubmit so that the form 
model object is sent to the persistence layer and printed immediately afterwards. The 
persistence layer *may* alter the object, so I have to reload it. My problem is that this 
reloading causes a "page expired" when I press the button for a second time.

My onSubmit:

if(getForm().process()){
   MyBean data=getForm().getModelObject();

   data=Persistence.save(data);

   // Create PDF and send it to the browser
   IResourceStream s = new ByteArrayResource("application/pdf", 
buildPDF(data)).getResourceStream();
   RequestCycle.get().setRequestTarget( new ResourceStreamRequestTarget(s) );

   getForm().setModelObject(data);
}

I think the page expires because sending the PDF to the browser "blocks" the 
request cycle, so the browser never renders the new version of the page.. Is there a way 
to do this? Am I doing Something Wrong? ^__^;
Many thanks for your time!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Andrew Klochkov


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to