3 Replies Latest reply on Jul 7, 2009 9:08 AM by Nick Belaevski

    problems with rich:combobox

    Sarang Agarwal Newbie

      I'm developing a quiz engine using richfaces. I am having problem using combobox. I want for question, different options should be displayed in the combobox. For this i m using List in the backing bean which is displayed in the combobox.
      Problem is how to select an option and get it displayed in outputtext or store the chosen value in the string.

      Here is the JSF code :

      <rich:spacer height="100px"></rich:spacer>
      <rich:panel header="Simple Echo">
      <rich:comboBox id="optionlist" value="#{options.sel}" defaultLabel="Enter some value">
      <f:selectItems value="#{options.option}" />

      Here is bean code:

      package Bean;

      import java.util.ArrayList;
      import java.util.List;
      import javax.faces.model.SelectItem;

      public class SelectOption {
      protected List option;
      protected String sel;

      public SelectOption(){
      option = new ArrayList();
      option.add(new SelectItem("101", "name1"));
      option.add(new SelectItem("102", "name2"));
      option.add(new SelectItem("103", "name3"));
      option.add(new SelectItem("104", "name4"));

      public String getSel () {
      return sel;

      public void setSel (String item) {
      sel = item;

      public List getOption() {
      return option;

      public void setOption(List option) {
      this.option = option;

      I know this is a very simple issue but i m only a beginner in this field so please help me out people.

      Thanxs in advance.......