黑马程序员
JSTL–概述
JSTL–常用标签–if
- if没有else
JSTL–常用标签–choose
JSTL–常用标签–foreach
<%@ page import="java.util.ArrayList" %><%--
Created by IntelliJ IDEA.
User: 联想
Date: 2020/10/4
Time: 20:14
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<c:if test="true">
我是真
</c:if>
<%
request.setAttribute("num",5);
%>
<c:choose>
<c:when test="${num == 5}">测试</c:when>
<c:otherwise>输入有误</c:otherwise>
</c:choose>
<c:forEach begin="0" end="10" step="2" var="i" varStatus="n">
${i} ${n.index} ${n.count}
</c:forEach>
<%
ArrayList arrayList = new ArrayList();
arrayList.add("aaa");
arrayList.add(1);
arrayList.add(5);
request.setAttribute("list",arrayList);
%>
<br>
<c:forEach items="${list}" var="t">
${t}
</c:forEach>
</body>
</html>