日期:2014-05-17  浏览次数:20486 次

jsp页面<select>选中问题
<select name="xx" id="xx">
 <option value="1">
 <option value="2">
 <option value="3">
</select>

我想实现后台传值,前台取值并选中
${xxx.ss}
要怎么弄啊?


------解决方案--------------------
介个也太简单了吧。。。。。
加入你后台传递过来的变量是 val,改成如下
<select name="xx" id="xx">
 <option value="1" <c:if test="${val==1}">selected="selected"</c:if>></option>
 <option value="2" <c:if test="${val==2}">selected="selected"</c:if>>
 <option value="3" <c:if test="${val==3}">selected="selected"</c:if>>
</select>
随手写的。。。。。