I am trying to create JSP page where I have two drop-downs. There are two-sets of data - First set Categories- Movies, Books, Music and the Second set Genres- Action,Comedy,Romantic.
Now the first dropdown will have all the values. The second drop-down depends upon the first one. For eg: If I select Movies from first dropdown, the second dropdown wil have-Action,Comedy,Romantic (all genres of Movies will be dispalyed). If I select Action from first dropdown, the second dropdown will have- Movies,Books,Music (all categories for Action will be displayed).
How can I create such dynamic dropdowns.
Also based on the values selected in the drop-downs, I should form a query path as Movies/Action or Action/Movies. I need to break up this path and query the database. So how can i know in the backend which is first category or genre.
I do not wish to use String manipulation since the data in the dropdowns can vary.I need some generic solution.
Its little complicated. Please let me know if anyone has a idea on this.Please help.