<c:choose>
<c:when test="${条件}">
情况1...........
</c:when>
<c:when test="${条件}">
 情况2...........
</c:when>
<c:otherwise>
否则。。。。。
</c:otherwise>
</c:choose>

jstl中if语句

<c:if>标签计算表达式,只有当表达式的值为true,则显示其主体内容。

属性:

<c:if>标签具有以下属性:

属性 描述 必需 默认
test 条件计算 Yes None
var 变量名称的存储条件的结果 No None
scope 变量的范围的存储条件的结果 No page

例子:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title><c:if> Tag Example - www.yiibai.com</title>
</head>
<body>
<c:set var="salary" scope="session" value="${2000*2}"/>
<c:if test="${salary > 2000}">
   <p>My salary is: <c:out value="${salary}"/><p>
</c:if>
</body>
</html>

这将产生以下结果:

My salary is: 4000

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-04
  • 2021-07-09
  • 2021-09-16
  • 2022-12-23
  • 2021-05-29
  • 2021-05-07
  • 2021-06-05
相关资源
相似解决方案