mosmartin
mosmartin

Reputation: 3

Implementing a Cascading DropDown with JSF 2

am trying to create a cascading drop down feature in my application using JSF 2.0. The level of cascade is 6. How does one go about doing this? I have googled but I haven't come across a good tutorial that explains it well.

Am also using the prime faces component library

Mos

Upvotes: 0

Views: 2613

Answers (1)

brcosta
brcosta

Reputation: 559

There is a example on how to do this on the primefaces showcase: http://www.primefaces.org/showcase/ui/pprSelect.jsf

To summarize, you need an ajax event handling on the first drop down:

<p:ajax update="suburbs" listener="#{pprBean.handleCityChange}" />

The listener will be executed and the component with "suburbs" as id (another dropdown) will be updated with the new data loaded from the listener. You can chain these ajax events in each drop down on your cascade :)

Upvotes: 1

Related Questions