• Post Reply Bookmark Topic Watch Topic
  • New Topic

session setAttribute null not working

 
Brusk Baran
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

even though I explicitly make the userID in the session null;
in a few code blocks later as the old userId. what is the magic here?
 
Mathias Nilsson
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried with a small scriptlet to test the session

Do you have a flush = true above your code?
// Mathias
[ November 04, 2003: Message edited by: Mathias Nilsson ]
 
Brusk Baran
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mathias,
1- it is not set to null!!!
2-ja, I have some included jsp files with flush=true ..
what effect can it have?
 
Damian Harvey
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
instead of setting it to null why don't you just call removeAttribute()?
D.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch damianharvey!
You'll find this forum a friendly place, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
Thanks!
bear
JSP Forum Bartender
 
B Mampilli
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Why synchronise the session object?
The session object is only available is this session and is not available to anyone else...
 
Brusk Baran
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok I solved the problem: It was the wrongly implementation of setAttribute null functionality of Visual Age and Websphere.
removeAttribute() works, but setAttribute("xx", null) NOT WORKS although the specs http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpSession.html#setAttribute(java.lang.String, java.lang.Object) say so: f the value passed in is null, this has the same effect as calling removeAttribute().
ps:the session must be synchronized, because i have different frames each of which reach the session. so be careful with sessions, for example Opera tabs always get the same session unless you close and open from scratch. IE also. You must open a new win from start programs, if u do CTRL-N, it will have the same sesion.
adieu,
Brusk Baran
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!