I am trying to download a csv file on click of a button. I have the following implementation, but the moment I click the button, I get a page expired messag开发者_StackOverflow中文版e
WebResource export = new WebResource() {
@Override
public IResourceStream getResourceStream() {
StringBuffer result = new StringBuffer();
for(Person person: tmpList){
result.append(person.toCSV()).append("\n");
}
return new StringResourceStream(result, "text/plain");
}
@Override
protected void setHeaders(WebResponse response) {
super.setHeaders(response);
response.setAttachmentHeader("person.csv");
}
};
export.setCacheable(false);
form.add(new ResourceLink("exportLink", export));
my html markup is as follows
<a wicket:id="exportLink"><button class="button">Export</button></a>
The error was because of serialization. one of the classes were not serialized
精彩评论