[nbj2ee] JSF showing values in
  • From: "karinh" < >
  • To:
  • Subject: [nbj2ee] JSF showing values in <h:selectOneMenu
  • Date: Fri, 28 Sep 2012 14:32:59 -0400

Hey Everyone,


im having a little trouble with this project im working on with jsf. it's 
probably not so difficult but im not seeing the right answer.

on the index.xhtml page i want to show a dropdown box with the values i 
initialized in the faces-config file.

as an example 
faces-config:

Code:
<property-name>animals</property-name>
    <list-entries>
        <value>Cat</value>
        <value>Dog</value>
    </list-entries>



index.xhtml:

Code:
<h:selectOneMenu id="animal" value="#{myBean.animal}">
                <f:selectItems value="#{myBean.animals}"></f:selectItems>
            </h:selectOneMenu>



MyBean:

Code:
 private String animal;
    private List<SelectItem> animals;

 public void setAnimals(List<String> items) {
    animals = new ArrayList<SelectItem>();
    for (String item : items){
      animals.add(new SelectItem(item));
    }
  }
    public List<SelectItem> getAnimals() {
         
        return animals;
    }




this is not showing the values in the dropdown box.
and i do not know what i have forgotten.
thanks in advance

Karin






[nbj2ee] JSF showing values in <h:selectOneMenu

karinh 09/28/2012

[nbj2ee] Re: JSF showing values in <h:selectOneMenu

Rick Fincher 09/29/2012

[nbj2ee] JSF showing values in <h:selectOneMenu

karinh 09/29/2012

[nbj2ee] Re: JSF showing values in <h:selectOneMenu

Rick Fincher 09/30/2012

[nbj2ee] Re: JSF showing values in <h:selectOneMenu

Antonio Varela 09/29/2012

[nbj2ee] Re: JSF showing values in <h:selectOneMenu

Antonio Varela 09/29/2012

[nbj2ee] JSF showing values in <h:selectOneMenu

karinh 09/29/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close