2012-04-08 35 views
0

大家好晚上我的logout.jsp代碼上的其他修復程序

我需要關於如何修復我的logout.jsp代碼的幫助。我使用MVC。爲了解決我的問題,我的問題是我有這個SidePannel.jsp和Content.jsp放在我的index2.jsp裏面。 SidePannel.jsp包含在Content.jsp鏈接的鏈接,Content.jsp將顯示相應的值,具體取決於在SidePannel.jsp上單擊的鏈接。問題是,每次我實現我的logout.jsp時,它都可以工作,但只在Content.jsp中,login.jsp的重定向將顯示在content.jsp處,而Sidepannel.jsp仍將保持工作狀態。無論如何要在login.jsp中完全重定向整個系統?我會在哪裏放置我的LogOut.jsp鏈接?

至於我迄今爲止所做的事情。

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> 
+0

我試圖命名我的框架集爲 name =「theFrameset」並將我的目標更改爲。它的作品,但問題是,logout.jsp將顯示在新標籤,我的意思是它會打開一個新的標籤顯示logout.jsp。任何解決方案 – Zark 2012-04-08 15:04:33

回答

1

這聽起來像你正在使用或類似的東西嵌入MAINF「指數」中的內容和側面板頁面頁。

我建議你用JSP包含嵌入代替。這將比iframe更高效,因爲只有一個文檔被提供而不是三個。它也將解決你目前的問題......如果我正確理解你的描述。