2000}">

2000

."/> 2000}">

2000

.">

Home  >  Article  >  Java  >  How to output jstl in if

How to output jstl in if

(*-*)浩
(*-*)浩Original
2019-05-20 16:36:533196browse

The if of JSTL is the tag, so how to output it? Let’s find out below.

How to output jstl in if

Grammar format:

<c:if test="<boolean>" var="<string>" scope="<string>">
   ...</c:if>

Attributes

tag has the following attributes:

##AttributeDescriptionIs it necessaryDefault value test Condition is Nonevar#Variable used to store condition resultsNoNonescopeThe scope of the var attributeNopage













Example:

<%@ 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:if 标签实例</title>
</head>
<body>
<c:set var="salary" scope="session" value="${2000*2}"/>
<c:if test="${salary > 2000}">
   <p>我的工资为: <c:out value="${salary}"/><p>
</c:if>
</body>
</html>

Result:            

我的工资为: 4000

The above is the detailed content of How to output jstl in if. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn