ResultSet         rs = null, rs2 = null;
ResultSet         rs = null;
  public void doGet(HttpServletRequest request, HttpServletResponse response)      throws IOException, ServletException  {    ServletPrinter    sp   = null;    PreparedStatement stmt = null;    Connection        conn = null;    ResultSet         rs = null, rs2 = null;    sp = new ServletPrinter(response, "Submit Story");    sp.printHTMLheader("RUBBoS: Story submission");    sp.printHTML("<center><h2>Submit your incredible story !</h2><br>\n");    sp        .printHTML("<form action=\"/rubbos/servlet/edu.rice.rubbos.servlets.StoreStory\" method=POST>\n"            + "<center><table>\n"            + "<tr><td><b>Nickname</b><td><input type=text size=20 name=nickname>\n"            + "<tr><td><b>Password</b><td><input type=text size=20 name=password>\n"            + "<tr><td><b>Story title</b><td><input type=text size=100 name=title>\n"            + "<tr><td><b>Category</b><td><SELECT name=category>\n");    conn = getConnection();    // int storyId =    // (Integer.valueOf(request.getParameter("storyId"))).intValue();    /*     * if (storyId == 0) { sp.printHTML( " <h3> You must provide a story     * identifier ! <br></h3> "); return; }     */    try    {      stmt = conn.prepareStatement("SELECT * FROM categories");      rs = stmt.executeQuery();    }    catch (Exception e)    {      sp.printHTML(" Failed to execute Query for SubmitStory: " + e);      closeConnection(stmt, conn);      return;    }    try    {      if (!rs.first())      {        sp            .printHTML("<h3>ERROR: Sorry, but this story does not exist.</h3><br>");        closeConnection(stmt, conn);        return;      }      //Add story to database      String Name;      int Id;      do      {        Name = rs.getString("name");        Id = rs.getInt("id");        sp.printHTML("<OPTION value=\"" + Id + "\">" + Name + "</OPTION>\n");      }      while (rs.next());    }    catch (Exception e)    {      sp.printHTML("Exception accepting stories: " + e + "<br>");    }    finally    {      closeConnection(stmt, conn);    }    sp        .printHTML("</SELECT></table><p><br>\n"            + "<TEXTAREA rows=\"20\" cols=\"80\" name=\"body\">Write your story here</TEXTAREA><br><p>\n"            + "<input type=submit value=\"Submit this story now!\"></center><p>\n");    sp.printHTMLfooter();  }