检票口下载 csv“页面已过期”错误
我正在尝试单击按钮下载 csv 文件。我有以下实现,但是当我单击按钮时,我收到页面过期消息
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));
我的 html 标记如下
<a wicket:id="exportLink"><button class="button">Export</button></a>
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 message
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该错误是由于序列化造成的。其中一个类未序列化
The error was because of serialization. one of the classes were not serialized