<%@ page session="false" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.util.Hashtable" %>
<%@ taglib uri="/ixtaglib" prefix="jsptut" %>

<html>
	<head>
		<title>IX TagLibrary example</title>
	</head>
	
	<body>
		This example shows how to use a simple tags with dynamic attributes.<br>
	
	 <UL><br>
   <LI><I>ForEach with Vector:</I><br>
   <% Vector theVector = new Vector() ;
      theVector.addElement("Hello" );
      theVector.addElement("World" );
   %>
   <jsptut:foreach item="element"  list="<%= theVector.elements() %>" >
   <% Object element = pageContext.getAttribute("element") ;%>
   <%=element%>
   </jsptut:foreach> 

   <LI><I>ForEach with Hashtable:</I><br>
   <% Hashtable theHash = new Hashtable() ;
      theHash.put("k1","Hello" );
      theHash.put("k2","World" );
   %>
   <jsptut:foreach item="key"  list="<%= theHash.keys() %>" >
   <% Object key = pageContext.getAttribute("key") ;%>

   Key: <%= key %> Value: <%= theHash.get(key) %><br>
   </jsptut:foreach> 

		<LI><I>Currency:</I><br>
   Format currency 9.3 = <jsptut:currency value="<%=9.3%>"/><br>
   Format currency 9.313 = <jsptut:currency value="9.313"/>
   <LI><I>ForEach with currency output:</I><br>
   <% Vector theVectorC = new Vector() ;
      theVectorC.addElement(new Double("21.34") );
      theVectorC.addElement(new Double("34.456") );
   %>
   <jsptut:foreach item="element"  list="<%= theVectorC.elements() %>" >
   <% Object element = pageContext.getAttribute("element") ;%>
   <% boolean expr = ((Double)element).doubleValue()> 25.0 ;%>
   <jsptut:if expr="<%=expr%>" >
   <%=element%> format=<jsptut:currency value="<%=(Double)element%>"/><br>
   </jsptut:if>
   </jsptut:foreach> 
		<LI><I>If true:</I><br>
   <jsptut:if expr="true">
     Hello here is the body
   </jsptut:if>
		<LI><I>If false:</I><br>
   <jsptut:if expr="false">
     When you this, the if Taglib implementation is wrong!
   </jsptut:if>
   <BR>After if-Tag --- Body write this out
   </UL>
   <br>
		End...
	</body>
</html>