Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

tag

tag

JSP Standard Label LibraryJSP Standard Tag Library

The tag is used to evaluate the value of an XPath expression. If true, its body content is executed; if false, its body content is ignored.

Syntax format



   

   ...



property

The tag has the following attributes:

property Description Whether it is required Default value
select The XPath expression to evaluate Is None
var The variable that stores the result of the condition No None
scope The scope of the var attribute No Page

Example Demonstration

The following example shows us how to use thetags:



<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

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

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







  JSTL x:if 标签





Books Info:

Padam History ZARA 100 Great Mistry NUHA 2000 Document has at least one element.
Book prices are very high

The running result is as follows:





BOOKS INFO:

Document has at least one  element. 

Book prices are very high


JSP Standard Label LibraryJSP Standard Tag Library