Thanks Igor, I like this suggestion:
add(new Link("export-link") {
onclick() {
getRequestCycle().setRequestTarget(new ComponentRequestTarget(dt));
WebResponse wr=(WebResponse)getResponse();
wr.setHeader(blah);
}
}
But it requires wicket 1.2.
I tried to use a simple Page that outputs CSV instead of HTML, but I am
unable to set the proper headers in the response. They are simply ignored.
public class DownloadPage extends WebPage {
//...
public void onRequest() {
WebResponse r = getWebRequestCycle().getWebResponse();
r.setHeader("Content-Disposition", "attachment; filename=\"x.csv\"");
r.setHeader("Content-Type", "application/octet-stream");
}
I would have a look at the jasperreports project (though I doubt that it
solves my problem), but I can't connect to the servers.
I could even live with putting the information in the session and
redirecting to a servlet that outputs CSV. But wicket tries to modify
the headers after I set redirect headers, resulting in
WicketRuntimeExceptions.
Is there no solution? I really just want to return textual data with my
own content-type and content-disposition headers after a form submission.
Timo
Igor Vaynberg schrieb:
hi Timo,
please see this thread for a way to do it:
http://www.nabble.com/Rendering-DataTable-or-DataView-%28or-model%29-as-Excel-sheet-t1042760.html#a2711299
-Igor
On 3/16/06, Timo Stamm <[EMAIL PROTECTED]> wrote:
Hi,
I have a filterable table (based on DataView - nice work, thanks Igor)
and need a button to export selected entries as CVS.
After form submission, I can simply get the selected entries from an
extended IDataProvider implementation and generate the CSV data.
But how do I get the data to the client?
I searched the wiki, the mailing list and the API-docs, but couldn't
find a solution. It would be great to be able to redirect to a resource
just like it is possible with pages:
setResponseResource(new MyResource(myData));
A less elegant solution would be sufficient. It would be fine to store
the data on disk or in the session and redirect to a servlet to
download. But I can't find any way to do this, either.
Am I missing something?
Timo
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user