User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 392,071 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,217 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 10012 | Replies: 1
Reply
Join Date: Jun 2006
Posts: 1
Reputation: jeff_00789 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jeff_00789 jeff_00789 is offline Offline
Newbie Poster

Question JSP: How to Extract values from dropdown

  #1  
Jun 30th, 2006
Hi, i want to know how to extract values from drop down box for processing in next field. In my file first drop down has list of countries taken from a database. I want to show location of that particular country in the other dropdown. The list of all locations is also in the same database. My code is as follows.
<html><body><form name="frm" method="post" action="update.jsp">


<b>COUNTRY:</b>&nbsp;</td>
<select name="coun" style="width: 246px" onChange ="this.frm2.submit();"  ><option value="">Select</option>
		<% 
			 sql = dbconn.prepareStatement("select * from T500L order by LTEXT ");
					results = sql.executeQuery();
					while(results.next()){
					String name = results.getString(2);
					String id   = results.getString(1);
					
		%><option value="<%= name %>">
		<% out.println(name); %>
		
		</option>
		<%} results.close(); sql.close(); %>
		</select>						
		
                  <b>LOCATION:</b>&nbsp;</td>
                <select name="loc" style="width: 246px"><option value="">Select</option></select>


</form>
</body>
</html>


could anyone please give me a solution.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2006
Posts: 6
Reputation: markenranosa is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
markenranosa markenranosa is offline Offline
Newbie Poster

Re: JSP: How to Extract values from dropdown

  #2  
Sep 21st, 2006
i have a suggestion create an arraylist,.. upon retrieving the values for the first dropown, store your needed values in the arraylistso that when you close the connection you can use arraylist in any possible ways that you want. Hope this helps.




Ken-Ken
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JSP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 12:06 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC