1.

Explain Jstl If Tag With An Example?

Answer»

The if tag is a conditional tag used to EVALUATE conditional expressions. When a body is supplied with if tag, the body is evaluated only when the expression is true. For EXAMPLE :

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

<html>
<HEAD>
<title>Tag Example</title>
</head>
<body>
<c:if TEST="${param.name == 'studytonight'}">
<p>Welcome to ${param.name} </p>
</c:if>
</body>
</html>

The if tag is a conditional tag used to evaluate conditional expressions. When a body is supplied with if tag, the body is evaluated only when the expression is true. For Example :

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

<html>
<head>
<title>Tag Example</title>
</head>
<body>
<c:if test="${param.name == 'studytonight'}">
<p>Welcome to ${param.name} </p>
</c:if>
</body>
</html>



Discussion

No Comment Found