?
前些天發現了一個巨牛的人工智能學習網站,通俗易懂,風趣幽默,忍不住分享一下給大家。點擊跳轉到教程。
- <c:forEach?items="${customerMap}"?var="item">??
- ????${item.code}
- ????${item.name}?
- </c:forEach>?
?
?
map的結構為: Map?customerMap = new HashMap();
??customerMap.put("code","我是code值");
??customerMap.put("name","我是name值");
寫到這里你應該知道以上的內容了,剩下的省略。
?
另外map對應的value是個對象,如下寫法:
<table height="300" border="1" cellpadding="1"> <tr> <td width="396"> <select id="selectAllList" name="selectAllList" style="width:300px" size="<%=Constants.choicePageCount%>" multiple="true"> <c:if test="${!empty customerMap}"> <c:forEach items="${customerMap}" var="item"> <option value="${item.key }" title=" 編碼:${item.value.customer_num },許可證號:${item.value.license_key },簡 稱:${item.value.short_name },聯系地址:${item.value.contact_address },聯系電 話:${item.value.contact_phone }"> ${item.value.corporate_name }</option> </c:forEach> </c:if> </select> </td> </tr>
</table>
?
?
?
c:foreach 循環一個HashMap,map中的value為一個bean,頁面獲取key即key對應bean中的屬性