Advertisement
Guest User

Untitled

a guest
Apr 1st, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1. <%--
  2.     Document   : index
  3.     Created on : 01-04-2016, 11:00:30
  4.     Author     : aft_alumno
  5. --%>
  6.  
  7. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  8.  
  9. <%! int cantidadIntentos = 0; %>
  10.  
  11. <%
  12.    
  13.    
  14.     String user_autorizado = "admin";
  15.     String pass_autorizado = "123";
  16.    
  17.     String user = request.getParameter("user");
  18.     String pass = request.getParameter("pass");
  19.    
  20.     String mensaje = "";
  21.     if (user_autorizado.equals(user) && pass_autorizado.equals(pass)){
  22.         mensaje = "Acceso Autorizado.";
  23.     }else{
  24.         mensaje = "Error de Acceso.";
  25.     }
  26.    
  27. %>
  28.  
  29. <% if (user != null && pass != null) { %>
  30.  
  31. <%= mensaje %>
  32.  
  33. <%= "<p><h6>Intento nro: " + (++cantidadIntentos)  + "</h6>" %>
  34. <% } %>
  35.  
  36. <!DOCTYPE html>
  37. <html>
  38.     <head>
  39.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  40.         <title>JSP Page</title>
  41.     </head>
  42.     <body>
  43.         <h1>Formulario</h1>
  44.         <form name="ingreso" method="post" action="">
  45.             <fieldset>
  46.                 <legend>Ingreso de Usuario</legend>
  47.                 <table width="400" border="0">
  48.                     <tr><td>Usuario:</td><td><input type="text" name="user"></td></tr>
  49.                     <tr><td>Password:</td><td><input type="password" name="pass"></td></tr>
  50.                 </table>
  51.                 <input type="submit">
  52.             </fieldset>
  53.                
  54.         </form>
  55.     </body>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement