Use the JSTL foreach and if when labels.
Add the following tag library and function library to jsp
<% @ Taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %> // required <% @ taglib uri = "http://java.sun.com/jsp/jstl/fmt" prefix = "fmt" %> // some formatting is required parameter, not Required
<% @ Taglib prefix = "fn" uri = "http://java.sun.com/jsp/jstl/functions" %> // the function to be used when processing data, not required
1. Traverse list <Object>
<C: forEach items = "$ {list}" var = "list" varStatus = "status">
$ {List. name}
</C: forEach>
2. Traverse list <String>
<C: forEach items = "$ {optList}" var = "optList" varStatus = "status">
$ {OptList}
</C: forEach>
3. Traverse list <Map <String, String>
<C: forEach var = "name" items = "$ {a}"> <c: forEach var = "entry" items = "$ {name}"> <c: out value = "$ {entry. key} "/> <c: out value =" $ {entry. value} "/> </c: forEach>
4. Traverse map
<C: forEach items = "$ {map}" var = "mymap"> <c: out value = "$ {mymap. key} "/> <c: out value =" $ {mymap. value} "/> </c: forEach>
5. if
Add
<c:if test="${salary > 2000}"> <p>My salary is: <c:out value="${salary}"/><p></c:if>
6. choose tag
<C: choose>
<C: when test = "$ {param <= 2}">
1 </c: when>
<C: when test = "$ {param >=2}">
2 </c: when> <c: otherwise>
$ {Param}
</C: otherwise> </c: choose>
Java enterprise-level general permission security framework source code SpringMVC mybatis or hibernate + ehcache shiro druid bootstrap HTML5
[Download java framework source code]