jsp - how to show the selected item in java server pages -
i have code showing selected item, it's not work
<select class="form-control" name="grade"> <option value="x" <%if(rs.getstring("grade")!=null){out.println('selected')}%>>x</option> <option value="xi" <%if(rs.getstring("grade")!=null){out.println('selected')}%>>xi</option> <option value="xii" <%if(rs.getstring("grade")!=null){out.println('selected')}%>>xii</option> </select>
<img src="https://i.stack.imgur.com/orbzi.png"/>
try changing to:
<option value="x" <%if(rs.getstring("grade")!=null){%>"selected"<%}%>>x</option> <option value="xi" <%if(rs.getstring("grade")!=null){%>"selected"<%}%>>xi</option> <option value="xii" <%if(rs.getstring("grade")!=null){%>"selected"<%}%>>xii</option>
Comments
Post a Comment