protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        HttpSession session = request.getSession();
        request.setCharacterEncoding("UTF-8");
        User loggedIn = (User) session.getAttribute("loggedIn");

        String gameidString = request.getParameter("gameid");
        int gameid = Integer.parseInt(gameidString);

        int points = 0;
        String notes = "";
        String rolenotes = "";

        if (!isLoggedIn(session)) {
            showJSP("index.jsp", request, response);
            return;
        }

        String idParam = request.getParameter("id");
        Player player = null;
        int id = 1;
        try {
            id = Integer.parseInt(idParam);
        } catch (Exception e) {
        }

        try {
            player = Player.getPlayer(id);
            if (Game.getGame(Player.getPlayer(id).getGameid()).getUserID() != loggedIn.getID()) {
                setError("Stop trying to hack the database!", request);
                showJSP("index.jsp", request, response);
                return;
            }
        } catch (SQLException ex) {
            Logger.getLogger(GameServlet.class.getName()).log(Level.SEVERE, null, ex);
        }

        if (player != null) {
            request.setAttribute("player", player);
            request.setAttribute("gameid", gameid);
            showJSP("player.jsp", request, response);
        } else {
            request.setAttribute("game", null);
            setError("The player was not found!", request);
            List<Player> players = null;
            try {
                players = Player.getPlayers(loggedIn.getID());
            } catch (SQLException ex) {
                Logger.getLogger(GameServlet.class.getName()).log(Level.SEVERE, null, ex);
            }
            request.setAttribute("players", players);
            showJSP("Game?id=" + gameid, request, response);
        }
    }