Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 2 如何检索JSF-rich:select控件的选定值?_Jsf 2_Richfaces_Managed Bean - Fatal编程技术网

Jsf 2 如何检索JSF-rich:select控件的选定值?

Jsf 2 如何检索JSF-rich:select控件的选定值?,jsf-2,richfaces,managed-bean,Jsf 2,Richfaces,Managed Bean,我有一个这样的组合框: <rich:select id="foo" value="#{fooVo.selectedFoo}" defaultLabel="Please select one"> <f:selectItems value="#{fooVo.fooList}"/> </rich:select> public List<SelectItem> processFooList() { ... List<SelectItem

我有一个这样的组合框:

<rich:select id="foo" value="#{fooVo.selectedFoo}" defaultLabel="Please select one">
  <f:selectItems value="#{fooVo.fooList}"/>
</rich:select>
public List<SelectItem> processFooList() {
  ...
  List<SelectItem> theList = theDao.getFooList();
  return theList;
}
假设
selectedFoo
应填写所选条目,我可以知道如何解决此问题吗

2012年8月15日更新-傻瓜如何更新?

列表的结构在DAO中:

public List<SelectItem> getFooList() {
  List<SelectItem> newList = new ArrayList<SelectItem>();

  Integer theValue = ...;
  String theLabel = ...;
  newList.add(new SelectItem(theValue.toString(), theLabel));
}
而在ActionBean类中,此列表最终将通过Spring依赖项注入到达托管bean
fooVo

@ManagedBean(name="theAction")
@SessionScoped
public class ActionBean {

  @ManagedProperty(value="#{fooVo}")
  private FooVo fooVo;

  public void setTheBo(IBoc theBo) {
    this.theBoc = theBo;
    this.FooVo.setFooList(theBo.processFooList());
  }
}

我在setter Spring DI期间填写
fooVo
的愚人列表,因为我希望
愚人列表
在页面加载时准备就绪。

如何填写
愚人列表
属性?通过
设置愚人列表
的setter方法。我的意思是如何在
愚人列表
中添加项目:
愚人添加(new SelectItem())
或类似的内容。@LuiggiMendoza我已经在愚人节上更新了详细执行情况。
@ManagedBean(name="theAction")
@SessionScoped
public class ActionBean {

  @ManagedProperty(value="#{fooVo}")
  private FooVo fooVo;

  public void setTheBo(IBoc theBo) {
    this.theBoc = theBo;
    this.FooVo.setFooList(theBo.processFooList());
  }
}