This tag is to use to define the Control statements In JSP. Like to choose or select from conditional Criteria…!

                                                 Voter.xml” (XML File for Program)

<?xml version="1.0" ?>












<%@ taglib uri="" prefix="c" %>

<%@ taglib uri="" prefix="x" %>



           <title>&lt;x:if&gt;Tag In JSTL</title>



             <center><b><h3>Voting Eligibility</h3>

             <c:import url="voter.xml" var="vtr"/>

             <x:parse xml="${vtr}" var="disp"/>

             <x:if select="$disp//vote">

                  <p><center><b>Only One Can vote </b></center></p>

             </x:if> <br />

             <x:if select="$disp/voter[1]/vote/age <= 18">

                     <center><b><p>You can Vote...</p></b></center>




        JSTL XML <x:if> Tag

In This Program We Create a XML File as per Mention above named ‘Voter.xml’. That will be accessed while compiling the Program. Required attributes are also declared with the mandatory Variable. The Body section contains the main part of structure like Import URL will import the contents from XML file on The Web page. The Condition will be checked as per either the candidate will vote or not. In the Last all the tags will be closed.

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.