Zark
Zark

Reputation: 13

Additional fixes on my logout.jsp code

Good evening everyone

I need help on how to fix my logout.jsp code. Im using MVC. To extract my problem, my problem is that I have this SidePannel.jsp and Content.jsp that is in placed inside my index2.jsp. SidePannel.jsp contains links the is linked at Content.jsp, Content.jsp will show corresponding value depending on the link that has been clicked at the SidePannel.jsp. The problem is that everytime I implement my logout.jsp, it works, but in the Content.jsp only, the redirection to login.jsp will be shown at content.jsp, the Sidepannel.jsp will still remain and still working. Is there anyway to fully redirect the whole system in login.jsp? Where will I put my LogOut.jsp Link?

For the things that I've done so far.

LogOut.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=ISO-8859-1">
<title>El Tres</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>

<%
if(session.getAttribute("username")== null ||     session.getAttribute("username").equals(""))
{
session.invalidate();
response.sendRedirect("login.jsp");
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Cache-Control", "must-revalidate");
response.setDateHeader("Expires",-1);
}
%>
</body>
</html>

SidePannel.jsp

<body>
<%
String role = (String) session.getAttribute("userRole");

if(role.equals("Admin")){
%>
<jsp:include page="SidePanelAdmin.jsp"/>
<%
}
else
{
%>
<jsp:include page="SidePanelFaculty.jsp"/>
<%
}
%>

</body>

Upvotes: 0

Views: 361

Answers (1)

Stephen C
Stephen C

Reputation: 718738

It sounds like you are using <iframe> or something like that to embed the content and side-panel pages within the mainf "index" page.

I suggest that you do the embedding using JSP includes instead. This will be more efficient than iframes because only one document is served rather than three. It will also solve your current problem ... if I understand your description correctly.

Upvotes: 1

Related Questions