如何使用 wicket 生成 table header

How to generate table header with wicket

我想通过 wicket

生成这个 table header
<tr>
    <th>Actions</th>
    <th>ID</th>
    <th>First Name</th>
    <th>Last Name</th>
    <th>Home Phone</th>
    <th>Cell Phone</th>
</tr>

其中 header 个名字保存在 arrayList

我尝试这样的事情。它生成我想要的但在 html 代码中它显示警告

- Invalid location of tag (div).

好在生成的 html 代码中没有显示 div 标签。 当我只想要 th 而没有 span 标签时,我不知道应该使用什么标签

        <tr>
            <div wicket:id="seasonNames"><th wicket:id="season">[season]</th></div>
        </tr>

一种方法是使用 DataTable 组件。在这种情况下,您必须传递 IColumn 个实例的列表并使用 HeaderToolbar。有关此方法,请参阅 Wicket-examples。

另一种方法是使用简单的转发器,如 RepeatingView 或 ListView。在那种情况下 wicket:id="seasonNames" 应该是 而不是

.