I have a pair of dropdown lists in a JSP file labeled 'speciality' and 'super_speciality'. Clicking on an option in the 'speciality' dropdown list dynamically populates options in the 'super_speciality' dropdown list. The values for these dropdown lists are sourced from a JavaScript file named 'specialities.js'. How can I retrieve the selected values from these two dropdown lists in either a Servlet or JSP?
Here is the content of my specialities.js file:
// specialities.js file var spl_arr = new Array("Dentist","Gynecologist/obstetrician","Dermatologist/cosmetologist", "Pediatrician","General Physician","Ayurveda","Cardiologist", "Orthopedist","Ear-nose-throat (ent)","Homeopath"); var SupSpl_arr = new Array(); SupSpl_arr[0]=""; SupSpl_arr[1]="General Dentists|Oral Pathologists|Periodontists|Orthodontists|Cosmetic Dentists|"; SupSpl_arr[2]="Maternal-fetal medicine|Family planning|Reproductive endocrinology and infertility|Female pelvic medicine and reconstructive surgery|Menopausal and geriatric |"; SupSpl_arr[3]="Cosmecaregiver|Desairologist|Hair colorist|Esthecaregiver|"; SupSpl_arr[4]="Fictional pediatricians|Neonatologists|Pediatric ophthalmologists|Pediatric organizations|Women pediatricians|"; SupSpl_arr[5]="Auto-isopathy|Classical homeopathy|Clinical homeopathy|Homotoxicology|Pluralistic homeopathy|"; SupSpl_arr[6]="Multiple Sclerosis (MS)|Parkinson’s disease (PD)|Ankylosing Spondylities (AS)|Rheumatoid arthritis (RA)|Paralysis|"; SupSpl_arr[7]="Cardiac electrophysiology|Echocardiography|Interventional cardiolog|Nuclear cardiology|Pediatric cardiology|"; SupSpl_arr[8]="Hand and Plastic Surgery|Pediatric Orthopaedics|Back and spine conditions|Trauma|"; SupSpl_arr[9]="OTOLOGY-NEUROTOLOGY (EAR)|RHINOLOGY (NOSE)|LARYNGOLOGY (THROAT)|HEAD/NECK/THYROID|ALLERGY|GENERAL OTOLARYNGOLOGY|PEDIATRIC OTOLARYNGOLOGY (CHILDREN)|"; SupSpl_arr[10]="Allergy and Immunology|Anaesthesiology|Endocrinology|Gastroenterology|"; function populateSuperSpecialities( specialityElementId, superSpecialityElementId ){ ... } function populateSpecialities(specialityElementId, superSpecialityElementId){ ... }
To include this JS file in your JSP:
Select Speciality: Select Super-Speciality: