File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Remove variable from session in javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Remove variable from session in javascript" Watch "Remove variable from session in javascript" New topic
Author

Remove variable from session in javascript

Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
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

Joined: Jan 10, 2002
Posts: 60053
    
  65

Why JavaScript? Is the condition you are checking a server-side or client-side condition?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
its a server-side condition.
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2712
    
    5

Originally posted by Kushagra Bindal:
its a server-side condition.


Then why not remove it using the server side component like JSP?


SCJP, SCWCD.
|Asking Good Questions|
Ravi Kotha
Ranch Hand

Joined: Mar 02, 2006
Posts: 53
You can do something like this in a JSP...



-Ravi
Srikanth Nutigattu
Ranch Hand

Joined: Oct 30, 2007
Posts: 114
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

Joined: Mar 02, 2006
Posts: 53
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

Joined: Jan 10, 2002
Posts: 60053
    
  65

<c:remove>
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
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().
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Remove variable from session in javascript
 
Similar Threads
doubt in JSTL
Wsad -> Sql
JSTL - collection in request vs. session
what/how to do (if above contains shopping cart items of type OrderPlantItem and total vars), set it
Removing from session in JSP