aspose file tools*
The moose likes JSP and the fly likes content of dropdown B will depend on what is selected on dropdown A Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "content of dropdown B will depend on what is selected on dropdown A" Watch "content of dropdown B will depend on what is selected on dropdown A" New topic
Author

content of dropdown B will depend on what is selected on dropdown A

Det7
Greenhorn

Joined: May 19, 2005
Posts: 1
hey guys, i want to know how to do this in JSP..

Say I have dropdown A:

<select name = "mySelect">

<option>A</option>
<option>B</option>
<option>C</option>

</select>

now depending on what was selected in drodpownA, drodown B will have the following options,

if "A" was selected, values 1, 2, and 3 will be the options
if "B" was selected, values 4, 5, and 6..
and if "C" was selected, values 7,8,9.

Now, these values (1-9) will be loaded from the database. and I just want to have a single page for the two dropdowns, how would that be possible? Could you write me the code?

I know how to pass values and load data from the database by using forms.
<form name = "myForm" method = "post" action= "display.do">
but we all know that the values will be processed by creating a submit button.

With a dropdown menu, how would that be?
Is this possible?
<select name = "mySelect" method = "Post" action = "Something.do">
then onChange (when an option is selected in the dropdown, the page will then process the data.

Thanx in advance!
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I have an example of this here:
http://simple.souther.us/not-so-simple.html


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: content of dropdown B will depend on what is selected on dropdown A