Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't get JSF selectOneMenu to show list of items

 
Phillip Ankerson
Greenhorn
Posts: 27
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, I welcome suggestions on a good JSF book. I'm trying to learn this stuff, it's great but massive.

I have a managed bean to retrieve a list of items from a database, and a jsf page to display the dropdown list as a selectOneMenu. The items don't show up in the drop down. Suggestions?

JSF page


Managed Bean


Pacor Entity Class
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18165
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The correct form of the f:selectItem for multiple values is:


where the corresponding value property accessor has the form:


An array of SelectItem objects is also possible. The selectItem model objects contain not only label/value pairs used to build the select options, but also additional option information as well.
 
Phillip Ankerson
Greenhorn
Posts: 27
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So my bean code public List<Pacor> getCores() {

should read public List<SelectItem> getCores() { ?

I think I have the rest of it...unless I'm missing something.

Thanks Tim.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18165
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Phillip Ankerson wrote:So my bean code public List<Pacor> getCores() {

should read public List<SelectItem> getCores() { ?

I think I have the rest of it...unless I'm missing something.

Thanks Tim.


 
Phillip Ankerson
Greenhorn
Posts: 27
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made that change but it still doesn't populate any values from the database. I'm not sure what to do next.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic