2013-01-23 62 views
0

在bean「結果」中,設置了一個arrayList「tempList」。然後將該bean設置爲會話。 我必須在JSP頁面上獲取arrayList元素。在jsp中訪問在bean中設置的列表

我沒有得到如何獲取其元素的方式。

請建議。

回答

1

使用JSTL <c:forEach>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
... 
<c:forEach items="${youSessionAttributeName}" var="i"> 
    Item <c:out value="${i}"/><p> 
</c:forEach>