有以下jsp页面-
default.jsp
在下面WebContent
EmployeeMenu.jsp
在下面WebContent/MenuPages
selectAccountToRemoveOwner.jsp
在下面WebContent/ActionsPages
我在 servlet 和 jsp 页面之间运行以下命令-
首先default.jsp
——
<html>
<head>
<link rel="stylesheet" href="Styles/Site.css" type="text/css" />
<title>Create new customer</title>
</head>
<body>
</script>
<form action="loginCheckServlet" method="POST">
//form ...
</form>
</body>
</html>
去 -loginCheckServlet
去doPost
-
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// forward to employee page ..
String addressMenuPage = "MenuPages/"
+"EmployeeMenu.jsp";
RequestDispatcher dispather =
request.getRequestDispatcher(addressMenuPage);
// go to this page ...
dispather.forward(request, response) ;
}
前往EmployeeMenu.jsp
——
<html>
<head>
</head>
<body>
<a href="ActionsPages/selectAccountToRemoveOwner.jsp">Remove owner from
account</a>
</body>
</html>
去selectAccountToRemoveOwner.jsp
-
<html>
<head>
</head>
<body>
<a href="../MenuPages/EmployeeMenu.jsp">Return to Employee menu</a>
</body>
</html>
回到EmployeeMenu.jsp
.
直到这里所有的链接都可以正常工作。但是现在,如果我再次按下链接EmployeeMenu.jsp
以进入,selectAccountToRemoveOwner.jsp
我会得到 -
HTTP Status 404 - /MyBankProject/MenuPages/ActionsPages/selectAccountToRemoveOwner.jsp
--------------------------------------------------------------------------------
type Status report
message /MyBankProject/MenuPages/ActionsPages/selectAccountToRemoveOwner.jsp
description The requested resource (/MyBankProject/MenuPages/ActionsPages/selectAccountToRemoveOwner.jsp) is not available.
请注意,该消息指的/MenuPages/ActionsPages
是确实不存在的位置。似乎从EmployeeMenu.jsp
到的过渡selectAccountToRemoveOwner.jsp
并没有改变当前的文件夹位置。