07 c:if的使用

pom.xml中添加jstl依赖

<dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
 </dependency>

在jsp页面引入核心标签库

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

写语句

<c:if test="<boolean>" var="<string>" scope="<string>">
   ...
</c:if>
属性 描述 是否必要 默认值
test 条件
var 用于存储条件结果的变量
scope var属性的作用域 page

示例 

<c:if test="${message!=null}" >
                   
  ${message}
                   
 </c:if>

猜你喜欢

转载自blog.csdn.net/shmily_syw/article/details/91811528
07