Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
How to apply choose tag in JSP?
The
Attribute
The
tag does not have any attribute. The
tag has one attributes which is listed below. The
tag does not have any attribute.
The
| Attribute | Description | Required | Default |
|---|---|---|---|
| test | Condition to evaluate | Yes | None |
Example
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<html>
<head>
<title><c:choose> Tag Example</title>
</head>
<body>
<c:set var = "salary" scope = "session" value = "${2000*2}"/>
<p>Your salary is : <c:out value = "${salary}"/></p>
<c:choose>
<c:when test = "${salary <= 0}">
Salary is very low to survive.
</c:when>
<c:when test = "${salary > 1000}">
Salary is very good.
</c:when>
<c:otherwise>
No comment sir...
</c:otherwise>
</c:choose>
</body>
</html>
The above code will generate the following result ?
Your salary is : 4000 Salary is very good.
Advertisements
