SHARE
TWEET

allah akbar

a guest Dec 6th, 2016 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package org.rb.servlets;
  2.  
  3. import java.io.IOException;
  4. import java.io.PrintWriter;
  5. import javax.servlet.ServletException;
  6. import javax.servlet.http.HttpServlet;
  7. import javax.servlet.http.HttpServletRequest;
  8. import javax.servlet.http.HttpServletResponse;
  9. import org.rb.servlets.Utilisateur;
  10.  
  11. public class Utilisateur extends HttpServlet {
  12.  
  13.     protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  14.  
  15.         String login = request.getParameter("login");
  16.         String password =  request.getParameter("password");
  17.  
  18.         Bdd connexion = new Bdd("jdbc:mysql://localhost:3306", "root", "root", "localhost", 3306);
  19.        
  20.  
  21.         connexion.executionQuery("CREATE TABLE test(abc INT(11), def STRING(12))");
  22.  
  23.        
  24.         request.setAttribute("login", login);
  25.         request.setAttribute("password", password);
  26.  
  27.         String loginU = "root";
  28.         String passwordU = "root";
  29.  
  30.        
  31.        response.setContentType("text/html;charset=UTF-8");
  32.        
  33.        
  34.        
  35.         try (PrintWriter out = response.getWriter()) {
  36.            
  37.             out.println("<!DOCTYPE html>");
  38.             out.println("<html>");
  39.             out.println("<head>");
  40.             out.println("<title>Servlet saisieTitre</title>");            
  41.             out.println("</head>");
  42.             out.println("<body>");
  43.             out.println("<h1>Servlet saisieTitre at " + request.getContextPath() + "</h1>");
  44.             out.println("</body>");
  45.             out.println("</html>");
  46.         }
  47.  
  48.         request.getServletContext().getRequestDispatcher("/index.jsp");
  49.     }
  50.  
  51.     // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
  52.  
  53.     @Override
  54.     protected void doGet(HttpServletRequest request, HttpServletResponse response)
  55.             throws ServletException, IOException {
  56.         processRequest(request, response);
  57.     }
  58.  
  59.     @Override
  60.     protected void doPost(HttpServletRequest request, HttpServletResponse response)
  61.             throws ServletException, IOException {
  62.        processRequest(request, response);
  63.        
  64.     }
  65.  
  66.     @Override
  67.     public String getServletInfo() {
  68.         return "Short description";
  69.     }
  70.  
  71. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top