In order to populate a selectOneListBox or selectOneChoice from a
database use:
<tr:selectOneListbox value="#{bean.aValue}" required="yes">
<f:selectItems value="#{myBacking.selectList}"
</tr:selectOneListbox>
selectList should be a collection of type SelectItem.
then your backing bean selectList should have a getter and a setter.
private List<SelectItem> selectList;
{
//TODO: instanciate the list and populate the list
}
public List<SelectItem> getSelectList() {
return selectList;
}
public void setSelectList(List<SelectItem> selectList) {
this.selectList = selectList;
}
the difference between selectOneListBox and selectOneChoice that
selectOneChoice is a drop down list and selectOneListBox is a list
box. take a look at the components guide demo.
http://www.irian.at/trinidad-demo/faces/components/selectOneChoice.jspx
http://www.irian.at/trinidad-demo/faces/components/selectOneListbox.jspx
--Omar
On Apr 28, 2009, at 7:01 PM, Mike Quentel wrote:
Please, would someone direct me to an example of populating a drop-
down
selection list using values from a database table query? Most
examples show
hard-coded values. I'm hoping to find an example (could be another
library
than Trinidad; like Tomahawk or ADF) that includes the JSP and bean.
I'm using Trinidad. Not clear what the difference is between a
selectOneListbox and a selectOneChoice.
http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_selectOneListbox.h
tml
http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_selectOneChoice.ht
ml
They both seem the same.
If I use either one of the above, does my bean need to use
CoreSelectOneListBox in order to populate the drop-down list?
http://myfaces.apache.org/trinidad/trinidad-api/apidocs/org/apache/myfaces/t
rinidad/component/core/input/CoreSelectOneListbox.html
Where I'm most confused is the proper syntax in the JSP...just need
a good
example.
Many thanks,
Mike Quentel