[nbj2ee] Re: JSF showing values in
  • From: Rick Fincher < >
  • To:
  • Subject: [nbj2ee] Re: JSF showing values in <h:selectOneMenu
  • Date: Sat, 29 Sep 2012 11:59:35 -0400

You don't show enough of your code to tell if there is a managed-bean entry, but there is no stand-alone <property-name> tag in faces-config.xml. There is such a tag that can be used inside the <managed-property> tag of the managed-bean tag.

Why are you using faces-config?  It is on the way to becoming obsolete.

If you want to make the menu options modifiable and localizable you should use resources.

Rick

On 9/28/2012 2:32 PM, karinh wrote:
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