Latest web development tutorials

<C: if> tag

JSP Standard-Tag-Bibliothek JSP Standard - Tag - Bibliothek

<C: if> -Tags Werturteil Ausdruck, wenn der Ausdruck den Wert true führt seine Hauptinhalt.

Syntax

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

Immobilien

<C: if> Tag hat folgende Attribute:

Immobilien Beschreibung notfalls Default
Test Zustand es ist keine
var Bedingungsvariablen werden verwendet, um das Ergebnis zu speichern, keine keine
Anwendungsbereich Scope var Attribut keine Seite

Die Demonstration

<%@ 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>

Ergebnisse sind wie folgt:

我的工资为: 4000

JSP Standard-Tag-Bibliothek JSP Standard - Tag - Bibliothek