我有一个页面,有一些下拉列表。加载页面时,根据列表,将显示一些下拉列表。现在想在列表视图中获取下拉列表选择的值,但我无法获得下拉选择选择的值。我该怎么做做得到这个值?
谁能告诉我如何实现这一目标。
html代码:
<table>
<tr wicket:id="tritems">
<th align="right"><span wicket:id="lblattr"></span></th>
<td><select wicket:id="attrvalue"></select></td>
</tr>
<tr><th align="right"><wicket:message key="targetsystem" /></th><td><select wicket:id="targetsystem" /></td></tr>
</table>
爪哇代码:
final ListView trView=new ListView("tritems", new PropertyModel(this, "attrBizRoles")) {
private IBizRole attrvalueBizRole=new BizRole();
@Override
protected void populateItem(ListItem item) {
attrBizRole = (IBizRole) item.getModelObject();
item.add(new Label("lblattr", attrBizRole.getName()));
// this list can get from attr
attrvalueBizRoles = (List<IBizRole>) attrBizRole.getChildBizRole();
if (attrvalueBizRoles.size()>0) {
attrvalueBizRole=attrvalueBizRoles.get(0);
}
DropDownChoice attrvalueChoice = new DropDownChoice("attrvalue",new PropertyModel<IBizRole>(this, "attrvalueBizRole"), attrvalueBizRoles,new IChoiceRenderer() {
@Override
public Object getDisplayValue(Object object) {
attrvalueBizRole = (IBizRole) object;
return attrvalueBizRole.getName();
}
@Override
public String getIdValue(Object object, int index) {
attrvalueBizRole = (IBizRole) object;
return String.valueOf(attrvalueBizRole.getId());
}
});
item.add(attrvalueChoice);
}
};
谢谢。