Whenever we want to check that the value entered by the user is fulfilling the condition or not, then in these condition the <c:if> tag is used. In this tag there is no way to specify the default value. This tag will not work if the value entered by the user doesn't match any of the condition given in the program. This tag is just like the if statement in java. This tag is not for applicable if we want to one thing if the condition is true, and another thing if the condition is false. In this situation this tag will become obsolete.
To make a program on this, it is important to use the following tld's in the lib folder. i.e. /WEB-INF/lib folder, first is jstl.jar and the second one is standard.jar. We have made a program on if statement using jstl library, in which we are going to print "Welcome to roseindia.net".
The code of the program is given below:
|<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<head><title>JSTL IF tag</title></head>
<body bgcolor = "#FFFFCC">
<h1><c:if test="true">Welcome to roseindia.net</c:if></h1>
The output of the program is given below:
Recommend the tutorial