我想问一下如何从列表框中的多项选择中获取价值,我在 zul 中有这样的代码:
<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>
我的问题是,我如何在我的控制器类中获取选定的值,我在我的按钮中使用onClick='..
,值 selectedUserAcc 不为 null 并且像我想要的那样进行测试,如果我在我的控制器类中传递操作(例如使用方法),我打印出来的值是 null..有人想帮助我我的班级出了什么问题吗?
我在控制器中的方法是这样的:
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();
}
}
希望有人可以帮助我..谢谢..:D