Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%--
- Document : index
- Created on : 28/02/2012, 00:00:15
- Author : Rodrigo Régio de Araujo
- --%>
- <%@page import="com.JavAgenda.Uteis.TestesUsuario"%>
- <%@page import="com.JavAgenda.Beans.Usuario"%>
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>JSP Page</title>
- </head>
- <body>
- <%
- Cookie ck5=null;
- Cookie cookies5[]=request.getCookies();
- int l=0;
- if(cookies5!=null){//Se a lista de cookies for diferente de null
- for(int i=0;i<cookies5.length;i++){//Procura os cookies um por um
- if(cookies5[i].getName().equals("ID")){//Se o cookie de indice i tiver um nome igual a id
- ck5=cookies5[i];//cookie recebe o cookie de indice i
- }
- }
- }
- if(ck5!=null){//Se o cookie for diferende de nulo
- TestesUsuario teste=new TestesUsuario();//Crio uma nova classe que trabalha com banco de dados
- Usuario u=teste.retornarUsuarioPorID(Integer.parseInt(ck5.getValue()));//Usuario u recebe o usuario retornado pelo banco
- %>Usuario já logado...<br/><br/>Seja bem vindo <%=u.getNome()%><br/><a href='Sistema.jsp'>Voltar</a> para a página do sistema
- <!--Esta é a minha duvida, o que devo fazer mais para esse botão funcionar??-->
- <br/><input type="button" value="Sair do sistema" /><%
- } else {//Se o cookie for igual a nulo o sistema pede para ele logar...
- %>
- <form action="validarLogin.jsp" method="POST">
- <table border="1">
- <thead>
- <tr>
- <th colspan="2">Entre no sistema</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Usuario</td>
- <td><input type="text" name="usu" value="" size="15" /></td>
- </tr>
- <tr>
- <td>Senha</td>
- <td><input type="password" name="sen" value="" size="15" /></td>
- </tr>
- <tr>
- <td><a href="registrar.jsp">Registrar</a></td>
- <td><input type="submit" value="Entrar" /></td>
- </tr>
- </tbody>
- </table>
- </form><%
- }
- %>
- </body>
- </html>
Add Comment
Please, Sign In to add comment