如何使用apache wicket在li标签内创建重复的链接列表? [英] how to create a repeating list of links inside a li tag using apache wicket?

查看:69
本文介绍了如何使用apache wicket在li标签内创建重复的链接列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Apache Wicket 中,我想从代码创建一个重复的链接列表.我不确定模板应该是什么才能获得如下所示的 html 结果:

In Apache Wicket I would like to create a repeating list of links from code. I am not sure what the template should be to get to an html result that looks like this:

<li><a href="whatevenrlink1">link1</a></li>
<li><a href="whatevenrlink2">link2</a></li>
<li><a href="whatevenrlink3">link3</a></li>

推荐答案

所以经过大量测试后,这对我有用.HTML 应如下所示:

so after much testing this worked for me. HTML should look like:

<ul>
  <ui wicket:id="LinkList"><a wicket:id="Link"><span wicket:id="Text"/></a></ui>
</ul>

然后重复的视图代码将是:

and then the repeating view code will be:

RepeatingView view = new RepeatingView("LinkList");

add(view);

WebMarkupContainer list = new WebMarkupContainer(view.newChildId());
ExternalLink externalLink = new ExternalLink("Link", "http://www.google.com");
externalLink.add(new Label("Text","Google"));
list.add(externalLink);

view.add(list);

这篇关于如何使用apache wicket在li标签内创建重复的链接列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆