• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP code to select a drop down item

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI FRIENDS
I HAVE A JSP CODE WITH A DROP DOWN LIST.i NEED A JSP PROGRAM WHERE IF I SELECT A DROPDOWN LIST ITEM I SHOULD BE ABLE TO DISPLAY CORRESPONDING VALUES IN ANOTHER DROP DOWN LIST
[ February 14, 2005: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 489
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will have to bring the data into the jsp as a map, and then
1. have a select field
2. loop thru the map keys and for each key add an option to the select field.
3. have an onChange() js event for the select field which will pick up the current key set in the select field, get its corresponding value from the map and set this value in another select field.

ram.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dolly, welcome.

Typing in all uppercase letters is considered screaming.
A lot of people won't help someone who screams at them.

There was acually a pretty long conversation about doing just this, yesterday.
See if this thread answers your question.
https://coderanch.com/t/359818/Servlets/java/Passing-parameters-jsp-servlet

If not, give us some more information about what you are trying to do.
Where are the values coming from, a database, hardcoded,...?
Does this have to be server side or could it be done on the client with Javascript?
 
reply
    Bookmark Topic Watch Topic
  • New Topic