我想在不使用downloadlink的情况下单击按钮后下载csv文件。使用downloadlink,我可以这样做:
DownloadLink link = new DownloadLink(wicketID, new AbstractReadOnlyModel<File>() {
private static final long serialVersionUID = 1L;
@Override
public File getObject() {
File tempFile;
try {
tempFile = File.createTempFile("test", ".csv");
InputStream data = new ByteArrayInputStream("some data for elli".getBytes());
Files.writeTo(tempFile, data);
} catch (IOException e) {
throw new RuntimeException(e);
}
return tempFile;
}
}
).setCacheDuration(Duration.NONE).setDeleteAfterDownload(true);
return link;
}
如何在正常检票口按钮的onSubmit
方法中执行此操作?我正在使用wicket 6。
答案 0 :(得分:1)
Wicket jQuery UI问题跟踪器已经回答:https://github.com/sebfz1/wicket-jquery-ui/issues/180#issuecomment-119539231