to the main page about the tutorial  INTERACTIVE WEB SERVICES WITH JAVA back up next

No Need to Program?

- the tag library approach goes to great length to avoid (blatant) programming.

Part of the philosophy behind JSP(/ASP/PHP) is:

This quickly breaks down:

The tag code:
<c:forEach var="item" items="$session:cart.items">	
   ...	
   <tr> 	
      <td align="right" bgcolor="#ffffff"> 	
      <c:expr value="$item.quantity"/>	
   </td>	
   ...	
</c:forEach>

abbreviates the JSP code:
<% 	
   Iterator i = cart.getItems().iterator();	
   while (i.hasNext()) {	
      ShoppingCartItem item =	
         (ShoppingCartItem)i.next();	
      ...	
%>	
      <tr>	
      <td align="right" bgcolor="#ffffff"> 	
      <%=item.getQuantity()%>	
      </td>	
      ...	
<% 	
   } 	
%>

This only works under a lot of assumptions:

Debugging rapidly becomes a pain...

back COPYRIGHT © 2002-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH next