• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to remove session attribute

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.. :(
 
Ranch Hand
Posts: 157
1
Android MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Aivis, probably you want to say here



also, there is no problem with the code except

which should be
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ;)

3.
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
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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. :)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic