JSTL1.1 的 forEach標(biāo)簽?zāi)茉贘SF標(biāo)簽中直接使用.
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> //導(dǎo)入的是JSTL 1.1 core Library
......
<table>
<tr>
<th>Item Name</th>
</tr>
<c:forEach items="#{frames.showKind}" var="k"> //item=List類型
<tr>
<td><h:outputText value="#{k.nowsum}" /><td>
</tr>
</c:forEach>
</table>
......
bean:
//用forEach循環(huán)中控制控件,會多次調(diào)用 items 方法訪問數(shù)據(jù)庫,所以需定義一個(gè)判斷.
public List getShowKind() {
if (null==showKind){
showKind=appinfoshow.showAllKind();
}
return showKind;
}
posted on 2008-04-23 13:56
紫蝶∏飛揚(yáng)↗ 閱讀(2427)
評論(1) 編輯 收藏 所屬分類:
JSF