【发布时间】:2023-04-11 07:41:02
【问题描述】:
我正在使用 JSP 为不同的登录用户打开他们自己的个人内容。我使用会话并在 logout.jsp 处失效。所以它不会在注销后通过复制 url 并尝试在浏览器中运行来打开 jsp 页面。但是我需要一个解决方案,当我使用一种类型的用户(例如:http://localhost:8080//CEO.jsp)登录时,如果我提供(例如:http://localhost: 8080//Staff.jsp) 它在同一个 CEO.jsp 页面中打开。我需要那个不打开。请帮我解决这个问题..
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" import="Accessing.UserBean"%>
<%@ taglib uri="/WEB-INF/tlds/birt.tld" prefix="birt" %>
<!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>Insert title here</title>
<script type="text/javascript" >
javascript:window.history.forward(1);
</script>
<style>
.title
{
width:769px;
height: 65px;
margin:15px auto;
}
.left
{float: left;
margin: 20px 50px 20px 30px;
padding: 0 0 25px 15px;
width:700px;
border: 1px solid #CCCCCC;
background-color: #CC6699;
color: #990066;
}
.right_side
{
float:right;
width:580px;
color: #000000;
background-color: #FFFFFF;
margin: 20px 0px 20px 10px;
padding:0px 0px 25px 15px;
border:1px solid #CCCCCC;
}
</style>
</head>
<%
UserBean currentUser =(UserBean)session.getAttribute("currentSessionUser");%>
<%
try{
if((String)currentUser.getRoles()!=null)
{
%>
<body bgcolor=#CC9999>
<div class="title">
<div class="rightside">
<a href="signingout.jsp">Logout</a>
</div>
</div>
<div class="left">
<birt:viewer id="birtViewer" reportDesign="BankCredit.rptdesign"
pattern="frameset"
height="450"
width="700"
format="html">
</birt:viewer>
</div>
<%
}
else
response.sendRedirect("signin.jsp");
}
catch(Exception e)
{
out.println("<br><br><br><br><br><br>");
out.println("<center><b><font color=red>SORRY!! ACCESS DENIED.INVALID USER.</font></b></center>");
out.println("<br><br>");
out.println("Please click here for <a href=signin.jsp><b>Login</b></a>");
}
%>
</body>
</html>
【问题讨论】:
-
是端口号后面的url中的双斜杠
//。 8080 打错字了?你能分享一些代码吗? -
是的,我重定向到三个不同的用户它可以工作,但唯一的问题是,当我打开单个用户的页面并更改另一个 jsp 页面的名称时,它显示该页面内容但页面以前的jsp 还在工作。例如:localhost:8080//CEO.jsp 并更改为 localhost:8080//Staff.jsp) 它在 CEO 中。 jsp 页面,但显示人员。 jsp 内容。请帮帮我
-
没有它的单一/错误我输入了它
标签: jsp