Qual verificação devo fazer se o usuário acessar diretamente a página home.jsp sem ter feito o login? Ressaltando que não estou utilizando servlet para esta situação, apenas páginas jsp.
Código da página home.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bem vindo</title>
</head>
<body>
<%
if ((session.getAttribute("login").equals(null)) || (session.getAttribute("login").equals(""))) {
%>
Você não esta logado. <a href="index.jsp">Por favor, entre com a sua conta.</a>
<%
} else {
%>
Seja bem vindo,
<%=session.getAttribute("login")%>
<center>
<a href="http://localhost:8080/Atividade07/listUsers">Listar -
Servlet</a><br> <a href="listar.jsp">Listar - JSP</a><br> <a
href='logout.jsp'>Log out</a>
</center>
<%
}
%>
</body>
</html>
Código da página login.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login</title>
</head>
<body>
<form action="checklogin.jsp" method="post">
<center>
<table border="1" width="30%" cellpadding="3">
<thead>
<tr>
<th colspan="2">Login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Login</td>
<td><input type="text" name="login"/></td>
</tr>
<tr>
<td>Senha</td>
<td><input type="password" name="senha"/></td>
</tr>
<tr>
<td><input type="submit" value="Login" /></td>
<td><input type="reset" value="Reset" /></td>
</tr>
<tr>
<td colspan="2">Ainda não esta cadastrado? <a href="register.jsp">Cadastra-se</a></td>
</tr>
</tbody>
</table>
</center>
</form>
</body>
</html>
Elucidando ainda mais o contexto desta aplicação segue uma imagem da aplicação, que deve implementar a figura abaixo (Apenas falta a parte que está destacada).