我需要使用rich:inplaceselect显示来自jsp页面的数据,我想将第一个名字和姓氏组合作为富含inplaceselect的值。我的问题是如何在bean中定义选择项?以及什么输入它会是什么?
答案 0 :(得分:0)
假设你声明你的inplaceSelect正确的方式:
<rich:inplaceSelect value="#{bean.value}" defaultLabel="click to edit">
<f:selectItems value="#{bean.selectItems}" />
</rich:inplaceSelect>
您的值必须是SelectItems类型,包含值和标签。
// populate your selectitems where you need them, getting your data from
// your database or somewhere else
List<SelectItem> items = new ArrayList<SelectItem>();
items.add(new SelectItem(...));
像这样访问您的选择项目集合。
public List<SelectItem> getSelectItems() {
return items;
}