Advertisement
Guest User

asDS

a guest
Oct 16th, 2016
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.65 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package cl.cvalpo.servlet;
  7.  
  8. import cl.cvalpo.dao.DAOUsuario;
  9. import cl.cvalpo.entities.Usuario;
  10. import java.io.IOException;
  11. import javax.servlet.ServletException;
  12. import javax.servlet.http.HttpServlet;
  13. import javax.servlet.http.HttpServletRequest;
  14. import javax.servlet.http.HttpServletResponse;
  15.  
  16. /**
  17.  *
  18.  * @author Esteban Perez
  19.  */
  20. public class Login extends HttpServlet {
  21.  
  22.     /**
  23.      * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
  24.      * methods.
  25.      *
  26.      * @param request servlet request
  27.      * @param response servlet response
  28.      * @throws ServletException if a servlet-specific error occurs
  29.      * @throws IOException if an I/O error occurs
  30.      */
  31.     protected void processRequest(HttpServletRequest request, HttpServletResponse response)
  32.             throws ServletException, IOException {
  33.         response.setContentType("text/html;charset=UTF-8");
  34.        
  35.         String username = request.getParameter("username");
  36.         String password = request.getParameter("password");
  37.        
  38.         DAOUsuario dao = new DAOUsuario();
  39.         Usuario us = dao.getUsuario(username, password);
  40.        
  41.     }
  42.  
  43.     // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
  44.     /**
  45.      * Handles the HTTP <code>GET</code> method.
  46.      *
  47.      * @param request servlet request
  48.      * @param response servlet response
  49.      * @throws ServletException if a servlet-specific error occurs
  50.      * @throws IOException if an I/O error occurs
  51.      */
  52.     @Override
  53.     protected void doGet(HttpServletRequest request, HttpServletResponse response)
  54.             throws ServletException, IOException {
  55.         processRequest(request, response);
  56.     }
  57.  
  58.     /**
  59.      * Handles the HTTP <code>POST</code> method.
  60.      *
  61.      * @param request servlet request
  62.      * @param response servlet response
  63.      * @throws ServletException if a servlet-specific error occurs
  64.      * @throws IOException if an I/O error occurs
  65.      */
  66.     @Override
  67.     protected void doPost(HttpServletRequest request, HttpServletResponse response)
  68.             throws ServletException, IOException {
  69.         processRequest(request, response);
  70.     }
  71.  
  72.     /**
  73.      * Returns a short description of the servlet.
  74.      *
  75.      * @return a String containing servlet description
  76.      */
  77.     @Override
  78.     public String getServletInfo() {
  79.         return "Short description";
  80.     }// </editor-fold>
  81.  
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement