Java 从列表框ZK中的多个选择中获取值
我想问一下如何从列表框中的多重选择中获取值,我在zul中有如下代码:Java 从列表框ZK中的多个选择中获取值,java,web-applications,zk,Java,Web Applications,Zk,我想问一下如何从列表框中的多重选择中获取值,我在zul中有如下代码: <n:tr> <n:td> <label value="Privilege"/> </n:td> <n:td> <label value=""/> &
<n:tr>
<n:td>
<label value="Privilege"/>
</n:td>
<n:td>
<label value=""/>
</n:td>
<n:td>
<listbox id="designations" model="@{addUser$composer.lstPrivilege}" selectedItem="@{selectedUserAcc, converter=com.nsia.doku.escrow.converter.SelectedItemConverter}" multiple="true" checkmark="true" width="200px">
<listitem self="@{each=lstPrivilege}" >
<listcell label="@{lstPrivilege.description}"/>
</listitem>
</listbox>
</n:td>
</n:tr>
<n:tr>
<n:td>
</n:td>
<n:td>
</n:td>
<n:td>
<button label="Submit" onClick='
import com.dokuescrow.dto.Activity;
ArrayList al = new ArrayList();
for (Activity li : selectedUserAcc)
{
al.add(li.activityId);
}
alert(al);
'/>
</n:td>
</n:tr>
public void onClick$submit(Event event){
try {
ArrayList al = new ArrayList();
for (Activity li : selectedUserAcc)
{
al.add(li.getActivityId());
}
alert(al.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
SelectedItemConverter select=new SelectedItemConverter();
for (Activity li : (Set<Activity>)select.coerceToBean(selectedUserAcc, getListGent()))
{
al.add(li);
}
List<Activity> act=al;
希望有人能帮助我..谢谢..:D好的,经过谷歌搜索和尝试(:D),我得到了这个问题的答案,你必须做的事情是调用你控制器中的转换器,我从ZK论坛得到的转换器 ,并更改返回对象(bot return null),我的程序如下:
<n:tr>
<n:td>
<label value="Privilege"/>
</n:td>
<n:td>
<label value=""/>
</n:td>
<n:td>
<listbox id="designations" model="@{addUser$composer.lstPrivilege}" selectedItem="@{selectedUserAcc, converter=com.nsia.doku.escrow.converter.SelectedItemConverter}" multiple="true" checkmark="true" width="200px">
<listitem self="@{each=lstPrivilege}" >
<listcell label="@{lstPrivilege.description}"/>
</listitem>
</listbox>
</n:td>
</n:tr>
<n:tr>
<n:td>
</n:td>
<n:td>
</n:td>
<n:td>
<button label="Submit" onClick='
import com.dokuescrow.dto.Activity;
ArrayList al = new ArrayList();
for (Activity li : selectedUserAcc)
{
al.add(li.activityId);
}
alert(al);
'/>
</n:td>
</n:tr>
public void onClick$submit(Event event){
try {
ArrayList al = new ArrayList();
for (Activity li : selectedUserAcc)
{
al.add(li.getActivityId());
}
alert(al.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
SelectedItemConverter select=new SelectedItemConverter();
for (Activity li : (Set<Activity>)select.coerceToBean(selectedUserAcc, getListGent()))
{
al.add(li);
}
List<Activity> act=al;
SelectedItemConverter select=newselecteditemconverter();
对于(活动li:(Set)select.impressedobean(selectedUserAcc,getListAgent())
{
加上(李);
}
列表act=al;
所以我得到了我想要的选择对象谢谢你的关注
litGen
是我的lisbox id