JSTL

来源:互联网 发布:硅谷ios程序员 编辑:程序博客网 时间:2024/06/05 09:56

JSTL是由5个不同功能的标签组成。

配置JSTL:

1,导包: <%@taglib  prefix="c(自定义)" uri="http://java.sun.com/jsp/jstl/core"%>

2:导入标签:

循环: <c:forEach var="遍历对象" items="${username}" varStatus="index" >
  <h1>${index.index+1}${cforname}</h1>
  </c:forEach>

条件:<c:if test()>  

多个条件:(只能有一个<c:otherwise>)

<c:choose>
  <c:when test="${index.index%5==0}"><br/></c:when>
  <c:otherwise></c:otherwise>
  </c:choose
>

原创粉丝点击