Sometimes we need to show HTML based on some conditions, so for this we use JSTl in JSP file.
Example: In the below code I'm changinf heading based on condition.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>Demo</title>
</head>
<body>
<c:choose>
<c:when test="${(apiKey != null && apiKey != '')}">
<h2> Public Map</h2>
</c:when>
<c:otherwise>
<h2> My Locations</h2>
</c:otherwise>
</c:choose>
</body>
</html>
Hopr this will help you:)
0 Comment(s)