I could be wrong - but maybe the question is about how best to structure
this in Wicket ..

it's just that easy (this is Scala, not Java):

  add( new Link( ImageLink.ID_LINK ) {
        def onClick = {
          val resourceStream = new ByteArrayResourceStream(
xlsExporter.createExcel, "application/vnd.ms-excel" );
          getRequestCycle.setRequestTarget( new ResourceStreamRequestTarget(
resourceStream ) {
            override def getFileName = "export.xls"
          } )
        }
      })

ByteArrayResourceStream is a simple implementation of IResourceStream. Creating
the Excel bytearray is another issue (I suggest using Apache POI).

or extend DynamicWebResource and return your own ResourceState with the excel file as a byte array returned by getData and use application/x-ms-excel as the content type. To link to the excel, mount the resource in your WebApplication, check the javadoc of ResourceReference on how to do so.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to