I just improved that request target a bit. Property responseType is
not needed there, as that can be (and should be) retrieved from the
resource stream (deprecated in 1.2, removed in 2.0) and I added a
fileName property which can optionally be used for the very common use
case where you want to set the content disposition and name of the
resulting download.

In 2.0, it can be used like this:

    Form form = new Form(this, "exportForm");
    new Button<String>(form, "exportButton", new Model<String>("export")) {

      @Override
      protected void onSubmit() {
        CharSequence export = DataBase.getInstance().exportDiscounts();
        ResourceStreamRequestTarget target = new ResourceStreamRequestTarget(
            new StringResourceStream(export, "text/plain"));
        target.setFileName("discounts.csv");
        RequestCycle.get().setRequestTarget(target);
      }

    };

I'll fix the WIKI too.

Eelco

On 9/19/06, Johan Compagner <[EMAIL PROTECTED]> wrote:
> that is wrong for wicket 1.2 yes.
> You should use a RequestTarget for that see for example:
> ResourceStreamRequestTarget
>
>
>
>
>
>
> On 9/18/06, Ralf Ebert <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > the solution for downloading a file immediately after a form submit
> >
> (http://www.wicket-wiki.org.uk/wiki/index.php/Best_Practices_and_Gotchas#Starting_download_after_form_submission_.28Wicket_1.1.29
> )
> > seems to be not working anymore for Wicket 1.2. Is there a way in
> > Wicket 1.2 to do this? It would be great if there would be a way to
> > redirect to a Resource, so existing DynamicWebResources could be
> > used...
> >
> > Regards and thx,
> > Ralf
> >
> >
> -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> > opinions on IT & business topics through brief surveys -- and earn cash
> >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to