You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Igor Vaynberg <ig...@gmail.com> on 2007/08/22 00:41:10 UTC
Re: IndicatingAjaxSubmitButton and download after form submission problem
you cannot stream back from ajax request directly, instead try doing
something like
window.location=somedownloadurl for ajax requests;
-igor
On 8/21/07, Martin Bednář <be...@triax.cz> wrote:
>
> Hi,
> I have problem when I use IndicatingAjaxSubmitButton for dowload after
> form submission.
>
> I use this code, normal Button working correctly. it's bug in
> IndicatingAjaxSubmitButton or I'm doing something wrong ?
>
> ...
>
> //This dosn't work
> form.add(new IndicatingAjaxSubmitButton("submit", form) {
> @Override
> protected void onSubmit(AjaxRequestTarget target, Form form)
> {
> processSubmit(); }
> });
> //This working
> form.add(new Button("submit") {
> @Override
> protected void onSubmit() {
> processSubmit();
> }
> });
>
>
>
>
> private void processSubmit() {
> final String zipArchiveFilename = "/tmp/sample.zip";
> RequestCycle requestCycle = this.getRequestCycle();
>
> final ResourceStreamRequestTarget exportTarget = new
> ResourceStreamRequestTarget(
> new FileResourceStream(new wicket.util.file.File(
> zipArchiveFilename)), "application/zip") {
> @Override
> protected void configure(Response arg0, IResourceStream arg1) {
> super.configure(arg0, arg1);
> WebResponse response = (WebResponse) arg0;
> setFileName("sample.zip");
> }
> };
>
> requestCycle.setRequestTarget(exportTarget);
> }
>
>