How to dynamically generate content of Drop Down List

UI Components for JSF
Post Reply
KingdomHeart
Posts: 280
Joined: 25 Jun 2010, 01:18

25 Jun 2010, 01:25

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

callahan
Posts: 768
Joined: 27 May 2010, 22:52

25 Jun 2010, 13:43

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.


KingdomHeart
Posts: 280
Joined: 25 Jun 2010, 01:18

25 Jun 2010, 17:52

Thank you so much. I will take a look at it.

Mojarra 2.1.10, Glassfish 3.1, Tomcat 7, Primeface 3.3.1
IE 6-8, FireFox 10-13
MAC OSX Lion, Windows XP, 7

paulbrickell
Posts: 13
Joined: 05 Jul 2010, 22:15

09 Nov 2010, 15:13

Any hints on how to style these a little better?

paulbrickell
Posts: 13
Joined: 05 Jul 2010, 22:15

09 Nov 2010, 18:26

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.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests