我有一个显示所选项目的代码,但它不起作用
<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"/>
&#13;
答案 0 :(得分:0)
尝试更改为:
<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>