Get value from jsp drop down in servlet
I have two drop down box , & the second drop down depends on what the user
has selected in the first drop down(done using javascript). As shown
below:
First drop down:
<div class="element">
<label for="category">Category </label>
<select id='stateCombo' onchange='stateComboChange();'>
<option value='-1' title='-select one-'>-select one-</option>
<option value='0' title='Mobile'>Mobile</option>
<option value='1' title='Nsw'>Routers</option>
<option value='2' title='Tas'>Datacard</option>
</select>
</div>
Second Drop down:
<div class="element">
<label for="category">Sub-Category </label>
<select id='cityCombo' name="category" onchange='cityComboChange();'>
<option value='-1' title='-select category first-'>-select category
first-</option>
</select>
</div>
Now i know how to get value from a particular field(say for input tag) in
servlet, we use:
request.getParameter("category");
But this statement doesn't work properly for drop down. It shows me the
value=0, when i save it to my database. Please help me find the above
solution.
No comments:
Post a Comment