aspose file tools*
The moose likes JSF and the fly likes how to populate dropdown in jsf thru database values? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "how to populate dropdown in jsf thru database values?" Watch "how to populate dropdown in jsf thru database values?" New topic
Author

how to populate dropdown in jsf thru database values?

Angellika desai
Greenhorn

Joined: Nov 06, 2011
Posts: 8
hey thr..

i m cmpltly new to jsf.. n its like terrible dream for me right now..

i want to know.. how to populate drop down in jsf from the valueds from database? please i want code...

thnaks in advance...
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Please read UseRealWords and NotACodeMill.
and avoid making entire post in bold letters, because it wont look good. people may just ignore your post !

Coming to your question, jsf has <h:selectOneMenu/> tag for your need!

and Welcome to JavaRanch Angellika desai!
Angellika desai
Greenhorn

Joined: Nov 06, 2011
Posts: 8
i would take care.. thanks for informing..

and yes i know this tag but

problem is how to get data from database into the drop down?
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Angellika desai wrote: problem is how to get data from database into the drop down?


You will need a list.

Create a method that will get the data from your database.

With this list, you will send the itens to your select one menu.

In this post, I show how to put your classes into a select menu. JSF: Converter and Bean AutoComplete


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Angellika desai
Greenhorn

Joined: Nov 06, 2011
Posts: 8
Thanks to all for your replies..i hope i get it worked soon..
 
Consider Paul's rocket mass heater.
 
subject: how to populate dropdown in jsf thru database values?