upwork/Internet Mediatech/Web App/PortaleDipendenti/src/java/LoginServlet.java
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        String userName = request.getParameter("user");
        String password = request.getParameter("password");
        HttpSession session = request.getSession();
        LoginDAO ld = new LoginDAO();
        if (ld.checkUser(userName, password)) {
            try {
                session.setAttribute("loginName", userName);
                DocumentListing dl=new DocumentListing();
                request.setAttribute("allDocuments", dl.documentsName());
                request.getRequestDispatcher("home.jsp").forward(request, response);
            } catch (Exception ex) {
                Logger.getLogger(LoginServlet.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            request.getRequestDispatcher("loginerror.jsp").forward(request, response);
        }
    }
/**
     * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
     * methods.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
Processes requests for both HTTP GET and POST
methods.

@param request servlet request
@param response servlet response
@throws ServletException if a servlet-specific error occurs
@throws IOException if an I/O error occurs
Processes requests for both HTTP GET and POST methods . @param request servlet request @param response servlet response @throws ServletException if a servlet - specific error occurs @throws IOException if an I / O error occurs
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        String userName = request.getParameter("user");
        String password = request.getParameter("password");
        HttpSession session = request.getSession();
        LoginDAO ld = new LoginDAO();
        if (ld.checkUser(userName, password)) {
            try {
                session.setAttribute("loginName", userName);
                DocumentListing dl=new DocumentListing();
                request.setAttribute("allDocuments", dl.documentsName());
                request.getRequestDispatcher("home.jsp").forward(request, response);
            } catch (Exception ex) {
                Logger.getLogger(LoginServlet.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            request.getRequestDispatcher("loginerror.jsp").forward(request, response);
        }
    }
protected void processRequest ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { response . setContentType ( "text/html;charset=UTF-8" ) ; String userName = request . getParameter ( "user" ) ; String password = request . getParameter ( "password" ) ; HttpSession session = request . getSession ( ) ; LoginDAO ld = new LoginDAO ( ) ; if ( ld . checkUser ( userName , password ) ) { try { session . setAttribute ( "loginName" , userName ) ; DocumentListing dl = new DocumentListing ( ) ; request . setAttribute ( "allDocuments" , dl . documentsName ( ) ) ; request . getRequestDispatcher ( "home.jsp" ) . forward ( request , response ) ; } catch ( Exception ex ) { Logger . getLogger ( LoginServlet . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } } else { request . getRequestDispatcher ( "loginerror.jsp" ) . forward ( request , response ) ; } }
Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 methods.
Processes requests for both HTTP <code > GET< / code > and <code > POST< / code > methods .