从后台传来数据 request.setAttribute("time", time), time有year、month属性,
而前台页面上的select中的option却已写死,
可以通过 jstl 表达式来进行判断。
这种写法只可以对简单的数据进行判断。
<select id="month" name="month">
<c:forEach var="item" begin="1" end="10" step="1">
<option value="${item}" <c:if test="${item==time.month}">selected</c:if>>${item}</option>
</c:forEach>
</select>