map的使用

 

//------------------------------------Finals -----------------------------------------

public static final Map<String,String> CANCI = new LinkedHashMap<String, String>();
static {
CANCI.put("01", "早餐");
CANCI.put("02", "午餐");
CANCI.put("03", "晚餐");
CANCI.put("04", "大夜宵");
CANCI.put("05", "小夜宵");
CANCI.put("06", "加班");
}

//------------------------------------ Controller 层 ----------------------------------------

 

model.addAttribute("CANCI", Finals.CANCI);

 

//------------------------------------ jsp 页面--------------------------

<c:forEach items="${CANCI}" var="map">
  <%-- <c:out value="${map.key}"></c:out> --%>
  <c:if test="${co.mealTimeCode == map.key }">${map.value }</c:if>
</c:forEach>

 

posted @ 2017-07-30 21:26  baby孔祥超  阅读(129)  评论(0编辑  收藏  举报