• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remove variable from session in javascript

 
Kushagra Bindal
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a variable in session. I want to check condition on my JSP page with the help of this variable and after that I want to remove this variable from the session.
Is their a way to do the same.

Please help me out in that.

Thanks
Kushagra
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why JavaScript? Is the condition you are checking a server-side or client-side condition?
 
Kushagra Bindal
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its a server-side condition.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kushagra Bindal:
its a server-side condition.


Then why not remove it using the server side component like JSP?
 
Ravi Kotha
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do something like this in a JSP...



-Ravi
 
Srikanth Nutigattu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do something like this in a JSP...


The code snippet you've provided is not recommended. You can use a servlet instead..

Or, you can use JSP but with JSP action tags or JSTL.
 
Ravi Kotha
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to remove an attribute in JSP using JSTL or custom tags? I know we can set an attribute using <jsp:setattribute>

-Ravi
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<c:remove>
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For JSTL you have <c:remove> to remove an attribute

for a custom tag you have the PageContext instance in the tag handler class, use that get an object of HttpSession and the remove the attribute from it using remoteAttribute().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic