protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        
        PrintWriter out = response.getWriter();
        try {
            /*
             * TODO output your page here. You may use following sample code.
             */
            HttpSession session = null;
            if(request.getParameter("htmlFormName")!=null){
                
                if(request.getParameter("htmlFormName").equals("form_1")){
                    UserBean u = new UserBean();
                    u.setPassword(request.getParameter("password"));
                    u.setUserName(request.getParameter("username"));
                    u.setRole(request.getParameter("role"));
                    u.setValid(true);
                    session = request.getSession();
                    session.setAttribute("currentSessionUser", u);
                    request.getRequestDispatcher("sign_up_2.jsp").forward(request, response);
                
                }
                else if(request.getParameter("htmlFormName").equals("form_2")){
                    UserRe ure = new UserRe();
                    ure.setCollegeID(Integer.parseInt(request.getParameter("CollegeID")));
                    ure.setBranch(request.getParameter("Branch"));
                    ure.setFirstName(request.getParameter("FirstName"));
                    ure.setLastName(request.getParameter("LastName"));
                    java.sql.Date DOB = new java.sql.Date(Integer.parseInt(request.getParameter("YYYY")), Integer.parseInt(request.getParameter("MM")),Integer.parseInt(request.getParameter("DD")));
                    ure.setDOB(DOB);
                    ure.setAddreessLine1(request.getParameter("Add_Str"));
                    ure.setAddressLine2(request.getParameter("Add_Line2"));
                    ure.setCity(request.getParameter("City"));
                    ure.setState(request.getParameter("State"));
                    ure.setCountry(request.getParameter("Country"));
                    
                    ure.setZip(Integer.parseInt(request.getParameter("Zip")));
                    ure.setMob(Long.parseLong(request.getParameter("Mob")));
                    ure.setEmail(request.getParameter("Email"));
                    ure.setAboutYou(request.getParameter("Abt_you"));
                    session = request.getSession(false);
                    ure.setUser((UserBean)session.getAttribute("currentSessionUser"));
                    boolean flag = ure.insert();

                    if(flag){
                        response.sendRedirect("home.jsp");
                    }


                }else if(request.getParameter("htmlFormName").equals("form_3")){
                    UserRe ure = new UserRe();
                    ure.setCollegeID(Integer.parseInt(request.getParameter("CollegeID")));
                    ure.setBranch(request.getParameter("Branch"));
                    ure.setFirstName(request.getParameter("FirstName"));
                    ure.setLastName(request.getParameter("LastName"));
                    java.sql.Date DOB = new java.sql.Date(Integer.parseInt(request.getParameter("YYYY")), Integer.parseInt(request.getParameter("MM")),Integer.parseInt(request.getParameter("DD")));
                    ure.setDOB(DOB);
                    ure.setAddreessLine1(request.getParameter("Add_Str"));
                    ure.setAddressLine2(request.getParameter("Add_Line2"));
                    ure.setCity(request.getParameter("City"));
                    ure.setState(request.getParameter("State"));
                    ure.setCountry(request.getParameter("Country"));
                    
                    ure.setZip(Integer.parseInt(request.getParameter("Zip")));
                    ure.setMob(Long.parseLong(request.getParameter("Mob")));
                    ure.setEmail(request.getParameter("Email"));
                    ure.setAboutYou(request.getParameter("Abt_you"));
                    session = request.getSession(false);
                    ure.setUser((UserBean)session.getAttribute("currentSessionUser"));
                    boolean flag = ure.update();

                    if(flag){
                        response.sendRedirect("aboutyou.jsp");
                    }


                }
            }
            else{
                
                request.getRequestDispatcher("sign_up_1.jsp").forward(request, response);
            }
                
        
        }catch(NumberFormatException ne){
            out.println(ne +" "+ne.getMessage()+ne.getStackTrace());
        }catch(Exception e){
            out.println(e+" "+ e.getMessage()+e.getStackTrace());
        }
        finally {            
            out.close();
        }
    }