JSP Logout HTTP Status 404 - Not Found
I have a JSP file called "logout.jsp" that I am trying to use to logout of my web application:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Logout</title>
</head>
<body>
<h1>Logout successful!</h1>
<%
session.invalidate();
response.sendRedirect("index.jsp");
%>
</body>
</html>
I am using a link on each of my other pages which looks like:
<a href="/WEB-INF/logout.jsp">Log out</a>
However, whenever I click on the link I get an error saying:
Http Status 404 - Not Found
Type - Status Report
message - Not Found
description - The requested resource is not available
Any help would be greatly appreciated as I've looked around and cannot seem to solve the issue
Cheers,
java jsp servlets
|
show 3 more comments
I have a JSP file called "logout.jsp" that I am trying to use to logout of my web application:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Logout</title>
</head>
<body>
<h1>Logout successful!</h1>
<%
session.invalidate();
response.sendRedirect("index.jsp");
%>
</body>
</html>
I am using a link on each of my other pages which looks like:
<a href="/WEB-INF/logout.jsp">Log out</a>
However, whenever I click on the link I get an error saying:
Http Status 404 - Not Found
Type - Status Report
message - Not Found
description - The requested resource is not available
Any help would be greatly appreciated as I've looked around and cannot seem to solve the issue
Cheers,
java jsp servlets
Do you have something like/logout
orlogout.jsp
in your paths?
– Samuel
Nov 25 '18 at 21:09
Sorry, could you please elaborate? I'm very new to MVC programming in Java. What paths do you mean?
– Seano989
Nov 25 '18 at 21:10
When you click on that link, it should be defined at the server side so that it knows what page to load.
– Samuel
Nov 25 '18 at 21:14
@Samuel So at the moment, the jsp file is just in a folder called "WEB-INF" in my netbeans project. I have edited my post above to show the file path however, it still gives the same error. Is there something i'm doing wrong?
– Seano989
Nov 25 '18 at 21:16
I see you've updated the post, do you have any other links working? likeindex.jsp
.
– Samuel
Nov 25 '18 at 21:19
|
show 3 more comments
I have a JSP file called "logout.jsp" that I am trying to use to logout of my web application:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Logout</title>
</head>
<body>
<h1>Logout successful!</h1>
<%
session.invalidate();
response.sendRedirect("index.jsp");
%>
</body>
</html>
I am using a link on each of my other pages which looks like:
<a href="/WEB-INF/logout.jsp">Log out</a>
However, whenever I click on the link I get an error saying:
Http Status 404 - Not Found
Type - Status Report
message - Not Found
description - The requested resource is not available
Any help would be greatly appreciated as I've looked around and cannot seem to solve the issue
Cheers,
java jsp servlets
I have a JSP file called "logout.jsp" that I am trying to use to logout of my web application:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Logout</title>
</head>
<body>
<h1>Logout successful!</h1>
<%
session.invalidate();
response.sendRedirect("index.jsp");
%>
</body>
</html>
I am using a link on each of my other pages which looks like:
<a href="/WEB-INF/logout.jsp">Log out</a>
However, whenever I click on the link I get an error saying:
Http Status 404 - Not Found
Type - Status Report
message - Not Found
description - The requested resource is not available
Any help would be greatly appreciated as I've looked around and cannot seem to solve the issue
Cheers,
java jsp servlets
java jsp servlets
edited Nov 25 '18 at 21:14
Seano989
asked Nov 25 '18 at 21:06
Seano989Seano989
103
103
Do you have something like/logout
orlogout.jsp
in your paths?
– Samuel
Nov 25 '18 at 21:09
Sorry, could you please elaborate? I'm very new to MVC programming in Java. What paths do you mean?
– Seano989
Nov 25 '18 at 21:10
When you click on that link, it should be defined at the server side so that it knows what page to load.
– Samuel
Nov 25 '18 at 21:14
@Samuel So at the moment, the jsp file is just in a folder called "WEB-INF" in my netbeans project. I have edited my post above to show the file path however, it still gives the same error. Is there something i'm doing wrong?
– Seano989
Nov 25 '18 at 21:16
I see you've updated the post, do you have any other links working? likeindex.jsp
.
– Samuel
Nov 25 '18 at 21:19
|
show 3 more comments
Do you have something like/logout
orlogout.jsp
in your paths?
– Samuel
Nov 25 '18 at 21:09
Sorry, could you please elaborate? I'm very new to MVC programming in Java. What paths do you mean?
– Seano989
Nov 25 '18 at 21:10
When you click on that link, it should be defined at the server side so that it knows what page to load.
– Samuel
Nov 25 '18 at 21:14
@Samuel So at the moment, the jsp file is just in a folder called "WEB-INF" in my netbeans project. I have edited my post above to show the file path however, it still gives the same error. Is there something i'm doing wrong?
– Seano989
Nov 25 '18 at 21:16
I see you've updated the post, do you have any other links working? likeindex.jsp
.
– Samuel
Nov 25 '18 at 21:19
Do you have something like
/logout
or logout.jsp
in your paths?– Samuel
Nov 25 '18 at 21:09
Do you have something like
/logout
or logout.jsp
in your paths?– Samuel
Nov 25 '18 at 21:09
Sorry, could you please elaborate? I'm very new to MVC programming in Java. What paths do you mean?
– Seano989
Nov 25 '18 at 21:10
Sorry, could you please elaborate? I'm very new to MVC programming in Java. What paths do you mean?
– Seano989
Nov 25 '18 at 21:10
When you click on that link, it should be defined at the server side so that it knows what page to load.
– Samuel
Nov 25 '18 at 21:14
When you click on that link, it should be defined at the server side so that it knows what page to load.
– Samuel
Nov 25 '18 at 21:14
@Samuel So at the moment, the jsp file is just in a folder called "WEB-INF" in my netbeans project. I have edited my post above to show the file path however, it still gives the same error. Is there something i'm doing wrong?
– Seano989
Nov 25 '18 at 21:16
@Samuel So at the moment, the jsp file is just in a folder called "WEB-INF" in my netbeans project. I have edited my post above to show the file path however, it still gives the same error. Is there something i'm doing wrong?
– Seano989
Nov 25 '18 at 21:16
I see you've updated the post, do you have any other links working? like
index.jsp
.– Samuel
Nov 25 '18 at 21:19
I see you've updated the post, do you have any other links working? like
index.jsp
.– Samuel
Nov 25 '18 at 21:19
|
show 3 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53471995%2fjsp-logout-http-status-404-not-found%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53471995%2fjsp-logout-http-status-404-not-found%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you have something like
/logout
orlogout.jsp
in your paths?– Samuel
Nov 25 '18 at 21:09
Sorry, could you please elaborate? I'm very new to MVC programming in Java. What paths do you mean?
– Seano989
Nov 25 '18 at 21:10
When you click on that link, it should be defined at the server side so that it knows what page to load.
– Samuel
Nov 25 '18 at 21:14
@Samuel So at the moment, the jsp file is just in a folder called "WEB-INF" in my netbeans project. I have edited my post above to show the file path however, it still gives the same error. Is there something i'm doing wrong?
– Seano989
Nov 25 '18 at 21:16
I see you've updated the post, do you have any other links working? like
index.jsp
.– Samuel
Nov 25 '18 at 21:19