wood burning stoves
The moose likes JSP and the fly likes Unable to remove session attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Unable to remove session attribute" Watch "Unable to remove session attribute" New topic

Unable to remove session attribute

Aivis Vidins

Joined: Nov 15, 2011
Posts: 3
Hi all,

I have two jsp files... (lets say A.jsp and B.jsp)

A contains a form and when it's submited it goes through B to process the data and then is redirected back to A. I'm able to add a session attribute on B, but for some odd reason I am not able to remove it anymore. I'm using the attribute to display a alert on A and once that's done I'd like to remove the attribute so that the alert doesn't pop up every time I open A after going through B. I tried removing the attribute on both A and B, but nothing seems to happen.

I'm using

content of A:

I can't really figure out what I am doing wrong and just nulling the attribute isn't an option. Any suggestions? Been sitting on this one for several days.. :(
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157

Hi Aivis, probably you want to say here

also, there is no problem with the code except

which should be
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

1. there is no HttpSession#addAttribute()

2. do not name a attribute like .. i.e,

you may get into trouble easily . for example
${sessionScope...} => will throw error. ofcourse you can use [] , as in ${sessionScope['..']} but that is different story ;)

for me, it is not neat . why cant you check in JS as below?

4. session.getAttribute("typeEx") are you sure about name *typeEx* ?
Aivis Vidins

Joined: Nov 15, 2011
Posts: 3
Sorry, my bad. The attribute is named 'typeEx'.. the value is irrelevant (but I'm using 'true') in this case. Checking the attribute in JS didn't work for me.

so it's..

[edit] Can someone close this? The problem has been resolved. :)
I agree. Here's the link: http://aspose.com/file-tools
subject: Unable to remove session attribute
It's not a secret anymore!