In the module am writing for tomcat, I want to provide two select menu(dropdown menu). There a so many tomcat instance and each of them has applications under them. Now, if someone want to upload a new jsp to a particular tomcat say /var/lib/tomcat5/webapps/myapp is where the jsp will be uploaded to. I want the first select menu to provide the list of all the tomcat instances on the server(This I have done successfully).
The second select menu should contain all the applications under the selected tomcat instance  from the first menu select. so if I select tomcat5, the second select menu should load automatically all the applications under tomcat5.

I know there is a javascript function that can do something like that (onchange or so). But how can I do this? Any help will be appreciated much.

I have my two menu select with the code below:

 print &ui_table_row($text{'inst_select'},
                &ui_select("inst", $in{'inst'},
                    [ map { [ $_ ] } @insts ] ) );

This is not working yet.
print &ui_table_row( $text{'select_app'},
                     &ui_select("ap", $in{'inst'},
                        [ map { [ $_ ] } @apps ] ) );

I will be using the two select menu to construct the directory to which the jsp is to be saved.