Page 1 of 1

How to dynamically generate content of Drop Down List

Posted: 25 Jun 2010, 01:25
by KingdomHeart
I am very new to JSF and PrimeFace. So please forgive my ignorance if the answer to the question is too obvious. I have couple Drop down list on my page. The contents of the drop down list are populated when the page is loaded. As I select the item in that first drop down list, content of the second drop down list get populated. How can I do that with JSF + PrimeFace. Sample code would be greatly appreciated

Re: How to dynamically generate content of Drop Down List

Posted: 25 Jun 2010, 13:43
by callahan
Hi,

There's an example in the PrimeFaces showcase that would be a good start. I can't link you to the online demo at the moment because the demo server appears to be down and I don't have the required URL in my head!

You can download the entire showcase from the download page http://www.primefaces.org/downloads.html

The xhtml file to look at is pprSelect.xhtml
The corrseponding bean is in PPRBean.java

pprSelect.xhtml has two <h:selectOneMenu> tags called "city" and "suburbs" that do what you want to do.

Re: How to dynamically generate content of Drop Down List

Posted: 25 Jun 2010, 17:10
by cagatay.civici

Re: How to dynamically generate content of Drop Down List

Posted: 25 Jun 2010, 17:52
by KingdomHeart
Thank you so much. I will take a look at it.

Re: How to dynamically generate content of Drop Down List

Posted: 09 Nov 2010, 15:13
by paulbrickell
Any hints on how to style these a little better?

Re: How to dynamically generate content of Drop Down List

Posted: 09 Nov 2010, 18:26
by paulbrickell
Actually never mind about that. I got busy with the CSS and prettified it.

I do wonder about styling these sorts of components (jsf/html) in general. For example the datatable's row cardinality selector. It looks a little naff compared to the other controls.