I have a website with select forms and am trying to make it work so that when a form is submitted, the select form retains what the user chose. I need to use JSP with servlet or Javascript.
<form method="post" id="mainForm" name="mainForm">
<div>
<label style="margin-left: 10px;" for="specialty">Specialty:</label>
<select name="specialty">
<option value="ob/gyn">OB/GYN</option>
<option value="surgeon">Surgeon</option>
<option value="heart surgeon">Heart Surgeon</option>
<option value="pediatrician">Pediatrician</option>
<option value="general physician">General Physician</option>
</select>
</div>
<div>
<label style="margin-left: 10px;" for="zipCode">ZIP Code:</label>
<input type="text" name="zipCode" value=<%=patient.getZip().substring(0, 5) %>>
</div>
<div>
<label style="margin-left: 10px;" for="range">Range From ZIP Code: </label>
<select name="range">
<option value="5">Exact (Match all 5 digits)</option>
<option value="4">Match first 4 digits</option>
<option value="3">Match first 3 digits</option>
<option value="2">Match first 2 digits</option>
<option value="1">Far (Match only first digit)</option>
</select>
</div>
<input type="submit" name="findExpert" value="Find Expert" />
What would I have to add to make this work?