sp.printHTML("Cannot lookup SB_RegisterItem: " +e+"<br>");
printError("Cannot lookup SB_RegisterItem: " +e+"<br>");
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException  {    String  name=null, description=null;    float   initialPrice, buyNow, reservePrice;    Float   stringToFloat;    int     quantity, duration;    Integer categoryId, userId, stringToInt;    String  startDate, endDate;    int     itemId;    sp = new ServletPrinter(response, "RegisterItem");          Context initialContext = null;    try    {      initialContext = new InitialContext();    }     catch (Exception e)     {      printError("Cannot get initial context for JNDI: " + e+"<br>");      return ;    }    String value = request.getParameter("name");    if ((value == null) || (value.equals("")))    {      printError("You must provide a name!<br>");      return ;    }    else      name = value;    value = request.getParameter("description");    if ((value == null) || (value.equals("")))    {      description="No description";    }    else      description = value;    value = request.getParameter("initialPrice");    if ((value == null) || (value.equals("")))    {      printError("You must provide an initial price!<br>");      return ;    }    else    {      stringToFloat = new Float(value);      initialPrice = stringToFloat.floatValue();    }    value = request.getParameter("reservePrice");    if ((value == null) || (value.equals("")))    {      reservePrice = 0;    }    else    {      stringToFloat = new Float(value);      reservePrice = stringToFloat.floatValue();    }    value = request.getParameter("buyNow");    if ((value == null) || (value.equals("")))    {      buyNow = 0;    }    else    {      stringToFloat = new Float(value);      buyNow = stringToFloat.floatValue();    }     value = request.getParameter("duration");    if ((value == null) || (value.equals("")))    {      printError("You must provide a duration!<br>");      return ;    }    else    {      stringToInt = new Integer(value);      duration = stringToInt.intValue();      GregorianCalendar now, later;      now = new GregorianCalendar();      later = TimeManagement.addDays(now, duration);      startDate = TimeManagement.dateToString(now);      endDate = TimeManagement.dateToString(later);    }    value = request.getParameter("quantity");    if ((value == null) || (value.equals("")))    {      printError("You must provide a quantity!<br>");      return ;    }    else    {      stringToInt = new Integer(value);      quantity = stringToInt.intValue();    }     userId = new Integer(request.getParameter("userId"));    categoryId = new Integer(request.getParameter("categoryId"));    // Try to create a new item    SB_RegisterItemHome regHome;    SB_RegisterItem reg;    try     {      regHome = (SB_RegisterItemHome)PortableRemoteObject.narrow(initialContext.lookup("SB_RegisterItemHome"),                                                     SB_RegisterItemHome.class);     reg = regHome.create();    }     catch (Exception e)    {      sp.printHTML("Cannot lookup SB_RegisterItem: " +e+"<br>");      return ;    }    try    {      String html;      sp.printHTMLheader("RUBiS: Selling "+name);      html = reg.createItem(name, description, initialPrice, quantity, reservePrice, buyNow, startDate, endDate, userId.intValue(), categoryId.intValue());      sp.printHTML("<center><h2>Your Item has been successfully registered.</h2></center><br>\n");      sp.printHTML("<b>RUBiS has stored the following information about your item:</b><br><p>\n");      sp.printHTML("<TABLE>\n");      sp.printHTML("<TR><TD>Name<TD>"+name+"\n");      sp.printHTML("<TR><TD>Description<TD>"+description+"\n");      sp.printHTML("<TR><TD>Initial price<TD>"+initialPrice+"\n");      sp.printHTML("<TR><TD>ReservePrice<TD>"+reservePrice+"\n");      sp.printHTML("<TR><TD>Buy Now<TD>"+buyNow+"\n");      sp.printHTML("<TR><TD>Quantity<TD>"+quantity+"\n");      sp.printHTML("<TR><TD>Duration<TD>"+duration+"\n");       sp.printHTML("</TABLE>\n");      sp.printHTML("<br><b>The following information has been automatically generated by RUBiS:</b><br>\n");      sp.printHTML("<TABLE>\n");      sp.printHTML("<TR><TD>Start date<TD>"+startDate+"\n");      sp.printHTML("<TR><TD>end date<TD>"+endDate+"\n");      sp.printHTML("<TR><TD>User id<TD>"+userId+"\n");      sp.printHTML("<TR><TD>Category id<TD>"+categoryId+"\n");      sp.printHTML(html);      sp.printHTML("</TABLE>\n");      sp.printHTMLfooter();    }    catch (Exception e)    {      printError("RUBiS internal error: Item registration failed (got exception: " +e+")<br>");      return ;    }     }