IfExample.jsp Page that uses the custom nested tags
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
Illustration of IfTag tag.
Taken from Core Web Programming Java 2 Edition
from Prentice Hall and Sun Microsystems Press,
.
May be freely used or adapted.
-->
<HTML>
<HEAD>
<TITLE>If Tag Example</TITLE>
<LINK REL=STYLESHEET
HREF="JSP-Styles.css"
TYPE="text/css">
</HEAD>
<BODY>
<H1>If Tag Example</H1>
<%@ taglib uri="cwp-taglib.tld" prefix="cwp" %>
<cwp:if>
<cwp:condition>true</cwp:condition>
<cwp:then>Condition is true</cwp:then>
<cwp:else>Condition is false</cwp:else>
</cwp:if>
<P>
<cwp:if>
<cwp:condition><%= request.isSecure() %></cwp:condition>
<cwp:then>Request is using SSL (https)</cwp:then>
<cwp:else>Request is not using SSL</cwp:else>
</cwp:if>
<P>
Some coin tosses:<BR>
<cwp:repeat reps="10">
<cwp:if>
<cwp:condition><%= Math.random() < 0.5 %></cwp:condition>
<cwp:then><B>Heads</B><BR></cwp:then>
<cwp:else><B>Tails</B><BR></cwp:else>
</cwp:if>
</cwp:repeat>
</BODY>
</HTML>