posted 18 years ago
Hi,
Option1: (One time database access - faster access). In this option, you do not need to go to database to retrieve relevant options in second List.
you can try one thing:
e.g. dropdown1, dropdown2, and dropdown3.
say you have 5 elements in dropdown1. Populate all relevant elements in dropdown2 List. Hence, for 1st element of dropwon1 there will be 1 list (multiple possible relevant values) in dropdown2. Similary, for dropdown2 corrosponding relevant elements in dropdown3 list.
Hence, values after populating all 3 lists will be like this:
Dropdown1
Index values
0A
1B
2C
3D
4E
Dropdown2
Index values
1List(AA,AB,AC,AD,AE,AF,AG)
2List(BA,BB,BC,BD)
3List(CA,CB,CE)
4List
Dropdown3
Hence, if user selects 3rd element in dropdown1, using javascript you can dynamically load all elements of 3rd List in Dropdown2 (List(CA,CB,CE)). Similarly for dropdown3 selection.
Populate all 3 lists before your jsp loads using action class and store in session or request scope. Once, user selects, onchange event of menu using javascript change relevant dropdown list.
Option2:
Retreive relevant option from Database everytime. However, you do not need to display on another jsp page. you can forward back to same jsp page.
-----
All the best