Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

dynamic dropdown with jsp

843840Oct 12 2009 — edited May 6 2010
Hi,
can someone suggest me how to implement following concept in JSP (only through jsp)

i have one dropdown list box,which is holding source values, on selecting source the second dropdown list box should display destination values from database.
i have some sample code snippet, but not sure what to put in "onchange". can anyone tell me, pls let me know if there are any easy ways to do this.

Source <select name="source" onchange="">
<option value="">Select Source</option>
<option value="jfk">JFK</option>
<option  value="heathrow">Heathrow</option>
<option  value="cst">Mumbai</option>
<option  value="chennai">Chennai</option>
</select>
Destination <select name="destination" >
<%
while(rs.next())
		{
			String destination = rs.getString("destination");
			out.println("<option value="+destination+">"+destination+"</option>");
			
		}
%>
</select>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 3 2010
Added on Oct 12 2009
4 comments
1,204 views