本系列博客汇总在这里:EL 表达式和 JSTL 标签汇总


目录


EL 表达式运算

EL 表达式和 JSTL 标签(2)_ EL_EL 表达式运算_3c

示例

EL 表达式和 JSTL 标签(2)_ EL_EL 表达式运算_3c_02

EL 表达式和 JSTL 标签(2)_ EL_EL 表达式运算_3c_03

以上操作完整源码:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>

<body>

<h1>EL表达式运算</h1>
<label>常量输出:</label>${10 }<br>
<label>四则运算:</label>${10+2 }, ${10-2 }, ${10*2 }, ${10/2 }, ${10 div 2 }<br>
<label>等于:</label>${10==10 }, ${10 eq 10 }<br>
<label>不等于:</label>${10 != 2 }, ${10 ne 2}<br>
<label>取余数:</label>${10%3 }, ${10 mod 3 }<br>
<label>小于:</label>${5 < 10 }, ${5 lt 10 }<br>
<label>大于:</label>${5 > 10 }, ${5 gt 10 }<br>
<label>小于等于:</label>${5 <= 10 }, ${5 le 10}<br>
<label>大于等于:</label>${5 >= 3 }, ${5 ge 3 }<br>
<label>逻辑与:</label>${true && true }, ${true and true }<br>
<label>逻辑或:</label>${true || false }, ${true or false }<br>
<label>逻辑非:</label>${!true } , ${not true }<br>
<label>判空:</label>${empty "" }<br>
<label>非空判断:</label>${empty not "" }

</body>

</html>

如有错误,欢迎指正!