java - Get value from jsp drop down in servlet -
i have 2 drop down box , & second drop down depends on user has selected in first drop down(done using javascript). 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 know how value particular field(say input tag) in servlet, use:
request.getparameter("category");
but statement doesn't work drop down. shows me value=0, when save database. please me find above solution.
you have check javascript functions statecombochange() , citycombochange(). think functions changing options tag in unexpected way.
like above answer have change value="0" value="mobile" or have take out value tag .
Comments
Post a Comment