如何在repeatingView Wicket内重复下载链接?
我正在处理wicketpage,我想在其中显示一个包含两列的动态表。 第一列应该有一个DownloadLink。第二列包含一个简单的标签。 问题是wicket显示的第一列是空的,所以我看不到downloadlink。 在这种情况下,如何向downloadLink添加标签如何在repeatingView Wicket内重复下载链接?,wicket,Wicket,我正在处理wicketpage,我想在其中显示一个包含两列的动态表。 第一列应该有一个DownloadLink。第二列包含一个简单的标签。 问题是wicket显示的第一列是空的,所以我看不到downloadlink。 在这种情况下,如何向downloadLink添加标签 ListDataProvider<String> listDataProvider = new ListDataProvider<String>(filesPaths); DataView
ListDataProvider<String> listDataProvider = new ListDataProvider<String>(filesPaths);
DataView<String> dataView = new DataView<String>("rows", listDataProvider) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(Item<String> item) {
String filePath = item.getModelObject();
RepeatingView repeatingView = new RepeatingView("dataRow");
String idLink = repeatingView.newChildId();
DownloadLink link = new DownloadLink(idLink, new File(filePath));
link.add(new Label(idLink + "label", filePath));
repeatingView.add(link);
Label label = new Label(repeatingView.newChildId(), "(TEST)");
label.add(new AttributeModifier("style", "color: blue;"));
repeatingView.add(label);
item.add(repeatingView);
}
};
add(dataView);
ListDataProvider ListDataProvider=新的ListDataProvider(文件路径);
DataView DataView=新数据视图(“行”,listDataProvider){
私有静态最终长serialVersionUID=1L;
@凌驾
受保护的无效填充项(项){
字符串filePath=item.getModelObject();
RepeatingView RepeatingView=新RepeatingView(“数据行”);
字符串idLink=repeatingView.newChildId();
DownloadLink=newdownloadlink(idLink,新文件(filePath));
添加(新标签(idLink+“标签”,filePath));
repeatingView.add(链接);
Label Label=新标签(repeatingView.newChildId(),“(测试)”);
添加(新的属性修改器(“样式”,“颜色:蓝色;”);
repeatingView.add(标签);
添加项(repeatingView);
}
};
添加(数据视图);
这是html页面的一部分
<table>
<tr wicket:id="rows">
<td wicket:id="dataRow"></td>
</tr>
</table>
您可以按如下方式设置链接名称:
downloadLink.setBody(Model.of("Download"));
这将设置链接到