The following methods are commonly used to traverse a set on a JSP page:
1. Use the struts tag library and ognl
For example:
<S: iterator value = "users">
<Tr>
<TD >$ {ID} </TD>
<TD >$ {username} </TD>
<TD> </TD>
<TD >$ {address} </TD>
<TD> <a href = "<% = PATH %>/ssi/useraction_deleteuserbyid? Id =$ {ID} "> Delete </a> </TD>
<TD> <a href = "<% = PATH %>/ssi/useraction_updateuserui? Id =$ {ID} "> modify </a> </TD>
</Tr>
</S: iterator>
2. Use jstl
<% @ Taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "C" %>
<C: foreach items = "$ {requestscope. Users}" Var = "user">
<Tr>
<TD >$ {user. ID} </TD>
<TD >$ {user. name} </TD>
<TD >$ {user. Age} </TD>
<TD >$ {user. Address} </TD>
<TD> <a href = "<% = PATH %>/useraction_deleteuserbyid? Id =$ {user. ID} "> Delete </a> </TD>
<TD> <a href = "<% = PATH %>/useraction_updateuserui? Id =$ {user. ID} "> modify </a> </TD>
</Tr>
</C: foreach>