demo1:
下拉框:
request域中数据
{"ownerList":[{"id":"1","username":"张三"},{"id":"2","username":"1111"},{"id":"3","username":"王五"}]}
已知当前登录用户user.id=1
html中jstl代码:
<select class="form-control" id="edit-transactionOwner"> <c:forEach items="${ownerList}" var="o"> <option value="${o.id}" ${o.id eq user.id ? "selected" : ""}>${o.username}</option> </c:forEach> </select> |