JSTL当中请给出一个c:choose和c:when:标签的例子

2021-07-15 18:00:05 浏览数 (1)

3)c:choose,c:when:标签

完成类似java的case的功能:

例 2.2.3

<%@ page contentType="text/html; charset=GBK"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<c:set var="salary" value="1300" />

<html>

<body>

<c:choose>

<c:when test="${salary <=1800}">

低薪

</c:when>

<c:when test="${salary<=3000&&salary>1800}">

中等

</c:when>

<c:otherwise>

高薪

</c:otherwise>

</c:choose>

</body>

</html>

更多请看: https://blog.csdn.net/qq_44594371/article/details/103183817

jsp

0 人点赞