c标签库中<c:if>的使用
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
//< 代表 <
//> 代表 >
/* int a=5;
int b=10;
if(a<b){
out.write("<h1>a小于b</h1>");
}else{
out.write("<h1>a大于等于b</h1>");
} */
request.setAttribute("a", 20);
request.setAttribute("b", 15);
%>
<!-- c:if 相当于 if语句 里面的test 都写 el表达式 -->
<!-- c:choose 下面的c:when 相当于 if 和else if c:otherwise 相当于 else -->
<!-- test el表达式 var 放test的结果 scope 指定放在哪个作用域 not也可以表示 !-->
<%-- <c:if test="${a>b}" var="result" scope="page">
<h1>a大于b</h1>
</c:if>
<c:if test="${!result}">
<h1>a小于等于b</h1>
</c:if> --%>
<c:choose>
<c:when test="${a>b}">
<h1>a大于b</h1>
</c:when>
<c:when test="${a<b}">
<h1>a小于b</h1>
</c:when>
<c:otherwise>
<h1>a等于b</h1>
</c:otherwise>
</c:choose>