处理下拉列表框是个比较费时间的问题,如果用EL表达式来弄相对比较省时间,代码如下:
<select id ='suggested_carrier'>
<c:forEach var="shipList" items="${shipList }">
<option value='${shipList}' ${shipList==suggestedCarrier?'selected':''}>
${shipList}
</option>
</c:forEach>
</select>
其中${shipList }为后台读取出的list,suggestedCarrier为当前应该被选择的value。
EL表达式处理下拉列表
本文介绍如何使用EL表达式简化下拉列表框的处理过程。通过示例代码展示了如何从后台获取列表数据并设置默认选中项。
939

被折叠的 条评论
为什么被折叠?



