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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -