Here's how I
used to do it:
1. Code an "onchange" event in the first dropdown that submits the form
2. Have the action class read the option selected in the first dropdown and build the list for the second dropdown
3. Redispaly the page, putting the focus on the second dropdown.
Now, I use AJAX, which is much smoother and doesn't require a redisplay of the page. Here's roughly how it works:
1. code an "onchage event in the first dropdown that makes an AJAX call to the server.
2. Code a server Method that will return a list of options based on what was selected in the first.
3. The "callback function" of the AJAX call takes the list of options returned and uses the Document Object Model (DOM) to build a second dropdown with the list of options.
This option requires learning some of the principles of AJAX, though, and will involve a bit of a learning curve. I'd suggest using
DWR as a framework for your AJAX calls.
[ June 12, 2006: Message edited by: Merrill Higginson ]