1、在pom中引入依赖

在maven 仓库中可以查看最新版

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
<dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
</dependency>

2、在jsp中插入

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

  java----jstl使用 随笔 第1张

 

 3、使用

利用c:if判断,如果message为空,就不显示;$(message!=null)

java----jstl使用 随笔 第2张

 

 

利用这种思路

如果简单可以使用这种方式来替代jstl

<div class="callout callout-danger" ${message==null?"style='display: none'":""}>
            <h4>${message}</h4>
</div>

或者

<div class="callout callout-danger" style="display: ${message==null?"none":""};" }>
            <h4>${message}</h4>
</div>

  

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄