This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Failed to display login link once user has logged out

 
Anas Nashroel
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !
 
Yong Lin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
session.removeAttribute("status").

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" />
</c:test>

Hope it a little help,forgive my poor english.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic