reset password
Author Message
baghumyan
Posts: 8
Posted 19:17 Feb 23, 2014 |

Prof Sun,

I use request.getSession().invalidate() to remove the course plan from the session scope but for some reason it does not remove it,
I also tried to use request.getSession().removeAttribute("nextCourses") but it still doesnt work. Could you please tell me why it wont remove it?

thank you

cysun
Posts: 2935
Posted 21:28 Feb 23, 2014 |

Either method (assuming your course plan is called "nextCourses") would remove it. If it's not removed, it's because some other bug in your code - for example, maybe you stored it in application scope instead of session scope, or maybe invalidate() or removeAttribute() was not called.

kaancalstatela
Posts: 52
Posted 00:48 Mar 20, 2014 |

Dunno if you still need help with this but I had the exact same problem while I was trying to fix my code for HW5. I found the solution to be invalidating the session and removing the attributes from the session scope when the done button is hit, also redirecting to logout page and removing attributes there via jsp. Some really rabbit hole stuff but did the trick. I suspect that for whatever reason, getSession().removeAttribute() does not respond unless you call it from another jsp and remove session attributes from there aswell. Hope it helps.