out.println("<a href=\"/servlet/edu.rice.rubis.servlets.PutBidAuth?itemId="+itemId+"\"><IMG SRC=\"/EJB_HTML/bid_now.jpg\" height=22 width=90> on this item</a>\n");
out.println("<a href=\"/servlet/edu.rice.rubis.servlets.PutBidAuth?itemId="+itemId+"\"><IMG SRC=\"/Servlet_HTML/bid_now.jpg\" height=22 width=90> on this item</a>\n");
  void printItemDescription(int itemId, String itemName, String description, float initialPrice, float reservePrice, float buyNow, int quantity, float maxBid, int nbOfBids, String sellerName, int sellerId, String startDate, String endDate, int userId, Connection conn)  {    PreparedStatement stmt = null;    try    {      String  firstBid;      // Compute the current price of the item      if (maxBid == 0)      {        firstBid = "none";      }      else      {        if (quantity > 1)        {          try           {             /* Get the qty max first bids and parse bids in this order               until qty is reached. The bid that reaches qty is the               current minimum bid. */            stmt = conn.prepareStatement("SELECT id,qty,max_bid FROM bids WHERE item_id=? ORDER BY bid DESC LIMIT ?");            stmt.setInt(1, itemId);            stmt.setInt(2, quantity);            ResultSet rs = stmt.executeQuery();            if (rs.first())            {              int numberOfItems = 0;              int qty;              do               {                qty = rs.getInt("qty");                numberOfItems = numberOfItems + qty;                if (numberOfItems >= quantity)                {                  maxBid = rs.getFloat("max_bid");;                  break;                }              }              while(rs.next());            }          }           catch (Exception e)          {            printHTML("Problem while computing current bid: "+e+"<br>");            return ;          }        }        Float foo = new Float(maxBid);        firstBid = foo.toString();      }      if (userId>0)      {        printHTMLheader("RUBiS: Bidding\n");        printHTMLHighlighted("You are ready to bid on: "+itemName);      }      else      {        printHTMLheader("RUBiS: Viewing "+itemName+"\n");        printHTMLHighlighted(itemName);      }      out.println("<TABLE>\n"+                  "<TR><TD>Currently<TD><b><BIG>"+maxBid+"</BIG></b>\n");      // Check if the reservePrice has been met (if any)      if (reservePrice > 0)      { // Has the reserve price been met ?        if (maxBid >= reservePrice)          out.println("(The reserve price has been met)\n");        else          out.println("(The reserve price has NOT been met)\n");      }      out.println("<TR><TD>Quantity<TD><b><BIG>"+quantity+"</BIG></b>\n"+                  "<TR><TD>First bid<TD><b><BIG>"+firstBid+"</BIG></b>\n"+                  "<TR><TD># of bids<TD><b><BIG>"+nbOfBids+"</BIG></b> (<a href=\"/servlet/edu.rice.rubis.servlets.ViewBidHistory?itemId="+itemId+"\">bid history</a>)\n"+                  "<TR><TD>Seller<TD><a href=\"/servlet/edu.rice.rubis.servlets.ViewUserInfo?userId="+sellerId+"\">"+sellerName+"</a> (<a href=\"/servlet/edu.rice.rubis.servlets.PutCommentAuth?to="+sellerId+"&itemId="+itemId+"\">Leave a comment on this user</a>)\n"+                  "<TR><TD>Started<TD>"+startDate+"\n"+                  "<TR><TD>Ends<TD>"+endDate+"\n"+                  "</TABLE>");      // Can the user buy this item now ?      if (buyNow > 0)        out.println("<p><a href=\"/servlet/edu.rice.rubis.servlets.BuyNowAuth?itemId="+itemId+"\">"+                    "<IMG SRC=\"/EJB_HTML/buy_it_now.jpg\" height=22 width=150></a>"+                    "  <BIG><b>You can buy this item right now for only $"+buyNow+"</b></BIG><br><p>\n");      if (userId<=0)      {        out.println("<a href=\"/servlet/edu.rice.rubis.servlets.PutBidAuth?itemId="+itemId+"\"><IMG SRC=\"/EJB_HTML/bid_now.jpg\" height=22 width=90> on this item</a>\n");      }      printHTMLHighlighted("Item description");      out.println(description);      out.println("<br><p>\n");      if (userId>0)      {        printHTMLHighlighted("Bidding");        float minBid = maxBid+1;        printHTML("<form action=\"/servlet/edu.rice.rubis.servlets.StoreBid\" method=POST>\n"+                  "<input type=hidden name=minBid value="+minBid+">\n"+                  "<input type=hidden name=userId value="+userId+">\n"+                  "<input type=hidden name=itemId value="+itemId+">\n"+                  "<input type=hidden name=maxQty value="+quantity+">\n"+                  "<center><table>\n"+                  "<tr><td>Your bid (minimum bid is "+minBid+"):</td>\n"+                  "<td><input type=text size=10 name=bid></td></tr>\n"+                  "<tr><td>Your maximum bid:</td>\n"+                  "<td><input type=text size=10 name=maxBid></td></tr>\n");        if (quantity > 1)          printHTML("<tr><td>Quantity:</td>\n"+                    "<td><input type=text size=5 name=qty></td></tr>\n");        else          printHTML("<input type=hidden name=qty value=1>\n");        printHTML("</table><p><input type=submit value=\"Bid now!\"></center><p>\n");      }    }    catch (Exception e)    {      out.println("Unable to print Item description (exception: "+e+")<br>\n");    }  }