File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Failed to display login link once user has logged out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Failed to display login link once user has logged out" Watch "Failed to display login link once user has logged out" New topic

Failed to display login link once user has logged out

Anas Nashroel

Joined: May 21, 2008
Posts: 12

I develop simple web application. I have a problem with the login/logout page.

Here's my logout.jsp page:

This logout page includes navigation file (navigation.jsp) that contains menus that a user can acess. Here's the navigation.jsp file:

The problem is, I wanted to show the login link once a user has logged out. I used this logic in my navigation.jsp file:

I invalidate session in my logout.jsp file, so the session should be null. This meets the condition required in the "if logic" above (session == null), so the login link should be displayed. But somehow, it is not displayed..

Any help would be appreciated..

Dev. Environment
Windows XP sp2
Tomcat 5.5
JRE 1.5.0_15
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2904

I am not sure about whether this works for you or not ..

So that its first invalidate the session and then goes to navigation.jsp..

Hope this help !

[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Yong Lin

Joined: Jun 05, 2008
Posts: 2
If cookie is not forbidden, session id is held by it to trace the session.

When session.invalidate is invoked,the current session will die,the session id will expire.

But if you continue to browse the page,web server will distribute another session to you,and put another session id in your cookie if your browser not forbid it.

So it is not a good idea to decide whether the user is loggin by testing session is null or not.

If user log out ,you can set the var "status" with "not loggin" or invoke

And another suggestion,try not to embed java code in jsp page,

you can use <c:if test="${(empty status)||'not loggin' eq status}" >
<jsp:include page="loggin.jsp" />

Hope it a little help,forgive my poor english.

A nice guy
I agree. Here's the link:
subject: Failed to display login link once user has logged out
It's not a secret anymore!