hi,
I have one drop down in my form. i want to access the selectd vaues from servlet. code in my servlet is:

String nval=request.getParameter("color");

in Jsp my code is:

............
 <select name="selectPrimaryKey">
<option>SelectValue</option>
<%
for (int i = 0; i < Nheadlist.size(); i++) {
	%>
<Option value="<%Nheadlist.get(i);%>"><%= Nheadlist.get(i) %>
</Option>
<%
}
%>
</select>

Can anyone please tell me how to get the selected value to the servlet........

thank you
regards
eclipse3.4ide

First of all the name of the select is: "selectPrimaryKey", so you will need something like this:

String nval=request.getParameter("selectPrimaryKey");

Also the select needs 1 minor change:

............
 <select name="selectPrimaryKey">
<option>SelectValue</option>
<%
for (int i = 0; i < Nheadlist.size(); i++) {
	%>
<Option value="<%= Nheadlist.get(i)%>" >
      <%= Nheadlist.get(i) %>
</Option>
<%
}
%>
</select>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.