private void outputList(HttpServletResponse response,FavoriteForm form,List<String> messages,UserBean user) throws IOException {
    	// Get the list of items to display at the end
    	FavoriteBean[] favorite;
        try {
        	favorite = hw8DAO.getUserFavorites(user.getId());
        	
        } catch (MyDAOException e) {
        	// If there's an access error, add the message to our list of messages
        	messages.add(e.getMessage());
        	favorite = new FavoriteBean[0];
        }
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();

        out.println("<html>");

        generateHead(out);

        out.println("<body>");
        out.println("<h2>Favorites for " + user.getFirstname() + " " + user.getLastname());
        out.println("</h2>");

        // Generate an HTML <form> to get data from the user
        out.println("<form method=\"POST\">");
        out.println("    <table>");
        out.println("        <tr><td colspan=\"3\"><hr/></td></tr>");
        out.println("        <tr>");
        out.println("            <td style=\"font-size: large\">URL:</td>");
        out.println("            <td colspan=\"2\"><input type=\"text\" size=\"40\" name=\"url\"/></td>");
        out.println("        </tr>");
        out.println("        <tr>");
        out.println("            <td style=\"font-size: large\">Comment:</td>");
        out.println("            <td colspan=\"2\"><input type=\"text\" size=\"40\" name=\"comments\"/></td>");
        out.println("        </tr>");
        out.println("        <tr>");
        out.println("            <td/>");
        out.println("            <td colspan=\"2\"><input type=\"submit\" name=\"what\" value=\"Add Favorite\"/>");
        out.println("                              <input type=\"submit\" name=\"what\" value=\"Logout\"/>");
        out.println("            </td>");
        out.println("        </tr>");
        out.println("    </table>");
        out.println("</form>");

        if(messages != null) {
        	for (String message : messages) {
            	out.println("<p style=\"font-size: large; color: red\">");
            	out.println(message);
            	out.println("</p>");
            }
        }
 
        out.println("<p style=\"font-size: x-large\">The list now has "+favorite.length+" Favorites.</p>");
        out.println("<table>");
        if(favorite != null) {
    		for(int i=0;i<favorite.length;i++) {
        		out.println("<table width=\"200\">");
        		out.println("  <tr>");
        		out.println("    <td><a href=\"HW8?favoriteId=" + favorite[i].getFavoriteId() + "\">" + favorite[i].getUrl() + "</a></td>");
        		out.println("  </tr>");
        		out.println("  <tr>");
        		out.println("    <td>" + favorite[i].getComments() + "</td>");
        		out.println("  </tr>");
        		out.println("  <tr>");
        		out.println("    <td>" + favorite[i].getCount() + " clicks</td>");
        		out.println("  </tr>");
        		out.println("</table>");
        		out.println("</br>");
    	    }
    	}

        out.println("</table>");

        out.println("</body>");
        out.println("</html>");
    }