JSTL标签 参考手册(转)

JSTL标签 参考手册:https://blog.csdn.net/elf8848/article/details/83287100

菜鸟教程:https://www.runoob.com/jsp/jstl-core-choose-tag.html
c标签判断两个值是否相等

Integer用:${user1.id eq user2.id}int用:${user1.id == user2.id}

测试代码如下:
<c:if test="${not empty listByParentId }">
    <c:forEach items="${listByParentId }" var="listByParentId">
       <c:if test="${listByParentId.parentId eq list.cwId }">
    …………
    …………
    …………
    </c:if>
  </c:forEach>
</c:if>    
菜鸟:
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>c:choose 标签实例</title>
</head>
<body>
<c:set var="salary" scope="session" value="${2000*2}"/>
<p>你的工资为 : <c:out value="${salary}"/></p>
<c:choose>
    <c:when test="${salary <= 0}">
       太惨了。
    </c:when>
    <c:when test="${salary > 1000}">
       不错的薪水,还能生活。
    </c:when>
    <c:otherwise>
        什么都没有。
    </c:otherwise>
</c:choose>
</body>
</html>



二号
   <c:set var="num" scope="page" value="admin"></c:set>
   <c:choose>
   <c:when test="${num=='guest' }">
   <c:out value="admin"></c:out>
   </c:when>
   <c:when test="${num=='admin' }">
      <c:out value="admin"></c:out>
   </c:when>
   <c:otherwise>
   <c:out value="other"></c:out>
   </c:otherwise>
   </c:choose>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值