public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        DBC dbc = new DBC();
        RequestDispatcher dispatcher;
        User u = new User(dbc,request);
        
        // redirect if user isn't logged in
        if(!u.isLoggedIn()){
            request.setAttribute("msg", "<p>You must be logged in to do that</p>");
            dispatcher = request.getRequestDispatcher("login.jsp");
            
            if (dispatcher != null) dispatcher.forward(request, response);
            else System.err.println("Error: File not found");    
            return;
        }
        
        Album a;
        int aid = -1;
        
        // parse aid from GET parameter
        try{ aid = Integer.parseInt(request.getParameter("aid")); }
        catch(NumberFormatException e){;}
        
        // if it's a valid album id
        if(aid > 0 ){
            a = new Album(dbc,aid); // get the album
            if(u.getUid() != a.getOwner()){ // redirect if the current user isnt the owner
                request.setAttribute("msg", "<p>You are not the owner of that album.</p>");
                dispatcher = request.getRequestDispatcher("login.jsp");
                if (dispatcher != null) dispatcher.forward(request, response);
                else System.err.println("Error: File not found");
                out.close();
            }
            else{   // is the current user
                // set beans
                request.setAttribute("album",a);
                request.setAttribute("unalbumed", Photo.getUserPhotosSingle(dbc, u.getUid()));
                
                // dispatch site
                dispatcher = request.getRequestDispatcher("editalbum.jsp");
                if (dispatcher != null)
                    dispatcher.forward(request, response);
                else System.err.println("Error: File not found");
                out.close();
            }
        }
        else{   // invalid AID       
            dispatcher = request.getRequestDispatcher("addalbum.jsp");
            if (dispatcher != null)
                dispatcher.forward(request, response);
            else System.err.println("Error: File not found");
            out.close();
        }
        out.close();
    }