我如何在 ZK ui 中显示 ArrayList?

How can i show an ArrayList in ZK ui?

我尝试了什么:

       <tabpanel>
            <listbox id="usersList" sizedByContent="true" span="true" model="@{users}">
                <listhead>
                    <listheader label="User Name"/>
                    <listheader label="gender"/>
                </listhead>
                <listitem self="@{each=users}">
                    <listcell label="@{user.userName}"/>    
                    <listcell label="@{user.gender}"/>
                </listitem>   
            </listbox>
        </tabpanel>

并且在 java 端:我有 ArrayList 用户,如果在将用户添加到此列表后单击提交....但我不知道如何在 UI 端显示它。 ...任何人都可以帮助我吗?非常感谢....我是 zk

的新手

您可以使用标签 <template>。 试试下面的代码:

       <tabpanel>
            <listbox id="usersList" sizedByContent="true" span="true" model="${users}">
                <listhead>
                    <listheader label="User Name"/>
                    <listheader label="gender"/>
                </listhead>
                <template name="model" var="user"> 
                    <listitem>
                        <listcell label="${user.userName}"/>    
                        <listcell label="${user.gender}"/>
                    </listitem>   
                </template>
            </listbox>
        </tabpanel>

但是如果您的列表在应用程序处于 运行 时发生变化,您可以使用 @load(users) 而不是 ${users}