This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP code to select a drop down item

 
DOLLY REDDY
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • 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.
http://www.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?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic