Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.18 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html >
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Application MMSP - Connexion</title>
  6. <link rel="stylesheet" href="inc/css/style.css">
  7.  
  8. </head>
  9.  
  10. <body>
  11.  
  12. <body>
  13.  
  14. <img id="logo0" src="inc/images/logo0.jpg">
  15. <div class="container">
  16. <section id="content">
  17. <form method="POST" action="connexionform" >
  18. <h1 >Application MMSP - Connexion </h1>
  19. <div>
  20. <input type="text" placeholder="username" required="" id="username" />
  21. </div>
  22. <div>
  23. <input type="password" placeholder="password" required="" id="password" />
  24. </div>
  25. <div>
  26. <input type="submit" value="Connexion" />
  27. <a href="#">Mot de passe oublié !</a>
  28. <a href="#">S'enregister</a>
  29. </div>
  30. </form><!-- form -->
  31. </section><!-- content -->
  32. </div><!-- container -->
  33. </body>
  34.  
  35. <script src="inc/js/index.js"></script>
  36.  
  37. </body>
  38. </html>
  39.  
  40. package beans;
  41.  
  42.  
  43.  
  44. public class User {
  45. private String username;
  46. private String password;
  47.  
  48. public User(String username, String password) {
  49. super();
  50. this.username = username;
  51. this.password = password;
  52. }
  53.  
  54. public String getUsername() {
  55. return username;
  56. }
  57.  
  58. public void setUsername(String username) {
  59. this.username = username;
  60. }
  61.  
  62. public String getPassword() {
  63. return password;
  64. }
  65.  
  66. public void setPassword(String password) {
  67. this.password = password;
  68. }
  69.  
  70. public User(){
  71. super();
  72. }
  73. }
  74.  
  75. package servlets;
  76.  
  77. import java.io.IOException;
  78.  
  79. import javax.servlet.RequestDispatcher;
  80. import javax.servlet.ServletException;
  81. import javax.servlet.http.HttpServlet;
  82. import javax.servlet.http.HttpServletRequest;
  83. import javax.servlet.http.HttpServletResponse;
  84. import javax.servlet.http.HttpSession;
  85.  
  86. import beans.User;
  87.  
  88. /**
  89. * Servlet implementation class ConnexionForm
  90. */
  91.  
  92. public class ConnexionForm extends HttpServlet {
  93. private static final long serialVersionUID = 1L;
  94.  
  95. /**
  96. * @see HttpServlet#HttpServlet()
  97. */
  98. public ConnexionForm() {
  99. super();
  100. // TODO Auto-generated constructor stub
  101. }
  102.  
  103. /**
  104. * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
  105. */
  106. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  107. // TODO Auto-generated method stub
  108. traitement(request,response);
  109. }
  110.  
  111. /**
  112. * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
  113. */
  114. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  115. // TODO Auto-generated method stub
  116. traitement(request,response);
  117. }
  118.  
  119. protected void traitement(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
  120. String username = request.getParameter("username");
  121. String password = request.getParameter("password");
  122.  
  123. User user = new User(username,password);
  124.  
  125. HttpSession maSession = request.getSession();
  126. maSession.setAttribute("utilisateur",user);
  127.  
  128. RequestDispatcher dispatcher = request.getRequestDispatcher("resultatLogin.jsp");
  129. dispatcher.forward(request, response);
  130. }
  131.  
  132. }
  133.  
  134. <HTML>
  135. <HEAD><TITLE></TITLE>
  136. </HEAD>
  137. <body>
  138. <div align="center">
  139. <h1>Veuillez vous identifier !!!</h1>
  140.  
  141. <form method="POST" action="connexionform">
  142. <table>
  143. <tr>
  144. <td>login :</td>
  145. <td><input type="text" name="username"></td>
  146. </tr>
  147. <tr>
  148. <td>Mot de passe :</td>
  149. <td><input type="password" name="password" value=""></td>
  150. </tr>
  151.  
  152. <tr>
  153. <td ></td>
  154. <td><input type="submit" value="Authentification"></td>
  155. </tr>
  156. </table>
  157. </form>
  158. </div>
  159. </body>
  160. </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement