A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
HttpSession and ServletContext - Difference?
Joined: Apr 20, 2011
Jun 13, 2011 03:41:44
I am unable to store a LinkedList in an HttpSession but can do with a ServletContext. why? what is the difference between the two?
Joined: Jul 13, 2008
Jun 13, 2011 03:54:23
What is the issue while stroring Linked list in HttpSession? Why you want to store in a session.
Session - values store with in a User session scope
ServletContext - Values store with in a
Joined: Feb 29, 2008
Jun 13, 2011 22:31:12
@Aatish - please post exact error/exception that you are facing while saving LinkedList in HTTPSession.
A very wild guess from my side -- are you facing NotSerializableException? if yes then please read on..
If your applicaion is clustered one (distributed), then all objects, which are supposed to be stored in HTTPSession, must implements Serializable interface. If you do not implement Serializable interface , then, notSerializableException is thrown. Below mentioned are the two old posts referring to same error
I agree. Here's the link:
subject: HttpSession and ServletContext - Difference?
Behavior of ServletContext VS Behavior of HttpSession
Diff between ServletContext and servletConfig
ServletContext, PageContext HttpSesstion and HttpServletRequest
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014