处理下拉列表框是个比较费时间的问题,如果用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。