Posted By:
Garrett_Smith
Posted On:
Wednesday, October 23, 2002 06:18 PM
How to iterate over a Hashtable? The page below compares using c:forEach with using a scriptlet. The scriptlet gives the desired result but the c:forEach loop yeilds an error. What is the correct syntax, please? Where can I obtain an online reference? Active Users With c:forEach With Scriptlet <% Hashtable users = (Hashtable)application.getAttribute("users"); if(users != null && users.size() > 0){ for(Enumeration e = users.elements() ; e.hasMoreElements() ;){ User user = (User)e.nextElement(); %> <%= user.getUsername() %&
More>>
How to iterate over a Hashtable?
The page below compares using c:forEach with using a scriptlet. The scriptlet
gives the desired result but the c:forEach loop yeilds an error. What is the
correct syntax, please? Where can I obtain an online reference?
Active Users
With c:forEach
With Scriptlet
<%
Hashtable users = (Hashtable)application.getAttribute("users");
if(users != null && users.size() > 0){
for(Enumeration e = users.elements() ; e.hasMoreElements() ;){
User user = (User)e.nextElement();
%>
- <%= user.getUsername() %>
<%
}
}
%>