March 13, 2005
Something Isn't Right

What kind of sick civilization would produce code like this?

<c:forEach var="item" items="${sessionScope.cart.items}">
  <c:set var="book" value="${item.item}" />
  <c:set var="bookId" value="${book.bookId}" />

  <sql:query var="books" 
    sql="select * from PUBLIC.books where id = ?" >
    <sql:param value="${bookId}" />
  </sql:query>
  <jsp:useBean id="inventory"
    class="database.BookInventory" />
  <c:forEach var="bookRow" begin="0"
    items="${books.rowsByIndex}">
    <jsp:useBean id="bookRow"  type="java.lang.Object[]" />
    <jsp:setProperty name="inventory" property="quantity"
      value="${bookRow[7]}" />

    <c:if test="${item.quantity > inventory.quantity}">
      <c:set var="sufficientInventory" value="false" />
      <h3><font color="red" size="+2">
      <fmt:message key="OrderError"/> 
      There is insufficient inventory for 
      <i>${bookRow[3]}</i>.</font></h3>
    </c:if>
  </c:forEach>
</c:forEach>
Posted by jjwiseman at March 13, 2005 04:06 PM
Comments

I don't know that "civilization" is really the word.

Posted by: Nick on March 13, 2005 05:20 PM

Ours.

Posted by: Guan Yang on March 13, 2005 09:41 PM

And I thought Template-Toolkit.org was perverted.

Posted by: Damir on March 13, 2005 11:42 PM

Where does this code come from?

Posted by: Pascal Costanza on March 14, 2005 01:04 AM

Welcome to the real world.
(I've seen worse. Much worse...)

Posted by: on March 14, 2005 03:59 AM

Hey! That looks a bit like LOOP!

Posted by: Marcin on March 14, 2005 04:01 AM

These are JSP tags.

Posted by: wcn on March 14, 2005 07:05 AM

as clunky as java and esp. jsp can be, don't all you highly-evolved lispers come away with the impression that it *has* to be done that way (it's a crime to mix data access/business logic & presentation like that in any language)

Posted by: jim on March 14, 2005 08:41 AM

Thank goodness my eyes are too tired to bleed.

Posted by: bi on March 15, 2005 02:00 AM

Looks like the evolution of language: http://homepages.inf.ed.ac.uk/wadler/language.pdf

Posted by: Florian on March 17, 2005 04:32 AM
Post a comment
Name:


Email Address:


URL:




Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)

Comments:


Remember info?