This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP code to select a drop down item Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP code to select a drop down item" Watch "JSP code to select a drop down item" New topic
Author

JSP code to select a drop down item

DOLLY REDDY
Greenhorn

Joined: Feb 08, 2005
Posts: 7
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

Joined: Jan 24, 2005
Posts: 489

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

Joined: Dec 11, 2004
Posts: 13410

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?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSP code to select a drop down item