728x90
728x90
SMALL
<x:otherwise>
- <when> 태그 다음에 오는 <choose>의 하위 태그이며 모든 이전 조건이 'false'로 평가된 경우에만 실행됩니다.
Attributes
- 정의된 속성이 없습니다.
Example
<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix = "x" uri = "http://java.sun.com/jsp/jstl/xml" %>
<html>
<head>
<title>JSTL x:choose Tags</title>
</head>
<body>
<h3>Books Info:</h3>
<c:set var = "xmltext">
<books>
<book>
<name>Padam History</name>
<author>ZARA</author>
<price>100</price>
</book>
<book>
<name>Great Mistry</name>
<author>NUHA</author>
<price>2000</price>
</book>
</books>
</c:set>
<x:parse xml = "${xmltext}" var = "output"/>
<x:choose>
<x:when select = "$output//book/author = 'ZARA'">
Book is written by ZARA
</x:when>
<x:when select = "$output//book/author = 'NUHA'">
Book is written by NUHA
</x:when>
<x:otherwise>
Unknown author.
</x:otherwise>
</x:choose>
</body>
</html>
Result
Books Info:
Book is written by ZARA
728x90
728x90
LIST
'JSP > JSTL XML' 카테고리의 다른 글
[JSP][JSTL XML] <x:forEach> (0) | 2021.08.06 |
---|---|
[JSP][JSTL XML] <x:if> (0) | 2021.08.06 |
[JSP][JSTL XML] <x:choose> (0) | 2021.07.30 |
[JSP][JSTL XML] <x:out> (0) | 2021.07.30 |