Home Jsp Simple-jsp-example Conditional Include with
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Conditional Include with

Advertisement
Whenever we want to check that the value entered by the user is fulfilling the condition or not, then in these condition the tag is used. In this tag there is no way to specify the default value.

Conditional Include with <c:if>

        

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" %>

<html>
<head><title>JSTL IF tag</title></head>
<body bgcolor = "#FFFFCC">
<h1><c:if test="true">Welcome to roseindia.net</c:if></h1>
</body>
</html>

The output of the program is given below:

Download this example.

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 12, 2008

Related Tutorials

Ask Questions?    Discuss: Conditional Include with  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com