Have you thought about using simply using a ResourceStremRequestTarget ?

On Wed, 2010-09-22 at 20:26 +0300, Altuğ Bilgin Altıntaş wrote:

> AjaxLink doesn't throw an Excel file to user.
> 
> Also I changed the code like that :
> 
>                  WebResponse wr =
> (WebResponse)*target.getHeaderResponse().getResponse()
> ;*
>                 wr.setContentType("application/vnd.ms-excel;
> charset=windows-1254" );
>                 wr.setCharacterEncoding(Constants.ENCODING);
>                 wr.setHeader("content-disposition", "attachment;filename=" +
> Constants.DEFAULT_EXCEL_FILE);
> 
> It sends the table via Ajax :) but no excel file download process begins
> 
> Any suggestions ?
> 
> Thanks.
> 
> 
> 
> 2010/9/22 Rodolfo Hansen <[email protected]>
> 
> > Use an AjaxLink (or extends abstractlink), this way the page version is
> > not expected to increment.
> >
> >
> > On Wed, 2010-09-22 at 18:27 +0300, Altuğ Bilgin Altıntaş wrote:
> > > Hi,
> > >
> > > Here is code to export excel;
> > >
> > >  Link linkExcel = new Link("linkExcel") {
> > >      public void onClick() {
> > >         getRequestCycle().setRequestTarget(
> > >                     new ComponentRequestTarget(tableContainer) {
> > >
> > >                         @Override
> > >                         public void respond(RequestCycle requestCycle) {
> > >                           .....
> > >                            WebResponse wr = (WebResponse) getResponse();
> > >                            wr.setContentType("application/vnd.ms-excel;
> > > charset=utf-8" );
> > >                            wr.setCharacterEncoding(Constants.ENCODING);
> > >                            wr.setHeader("content-disposition",
> > > "attachment;filename=" + Constants.DEFAULT_EXCEL_FILE);
> > >                         }
> > >
> > >  }
> > >
> > > It works great.
> > >
> > > *Problem steps  *:
> > >
> > >    1. Click excel link and get the excel file - great !
> > >    2. Click a modalwindow link (Ajax) gets "*Page Expired"* error.
> > >
> > >
> > > Any suggestions on *step 2* ?
> > >
> > > Thanks.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >


Reply via email to