jQuery in Action, 2nd edition*
The moose likes JSF and the fly likes Dynamic selectOneMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Dynamic selectOneMenu" Watch "Dynamic selectOneMenu" New topic
Author

Dynamic selectOneMenu

Bhaskar GR
Greenhorn

Joined: Jun 13, 2008
Posts: 28
Pls help me how to write dynamic selectOneMenu in backingBean
Dishpal Bhaluja
Ranch Hand

Joined: Dec 30, 2007
Posts: 96
Populating country field for example

<h:selectOneMenu>
<f:selectItemsValue="#{managedbean.country}"/>
</h:seleOneMenu>

In your managedbean
----------------------

public SelectItem[] country=
{ new SelectItem(new Integer(1),"India"}
new SelectItem(new Integer(2),"Pakistan"}
new SelectItem(new Integer(3),"Bangladesh"}
};

public SelectItem[] getCountry()
{
return country;
}

Thats all.Hope this will work for you.
Bhaskar GR
Greenhorn

Joined: Jun 13, 2008
Posts: 28
Iam asking without writing jsp code,i have to write
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Dynamic selectOneMenu