File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes error while setting the session for Enumeration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "error while setting the session for Enumeration " Watch "error while setting the session for Enumeration " New topic

error while setting the session for Enumeration

Raj kalaria
Ranch Hand

Joined: Sep 08, 2005
Posts: 72

I am trying to set a session in one of my class and trying to call in another class

try {
s_Query = ((DfQueryBuilder) m_IDfQueryBuilder).getDocbaseQuery("YOUR_DOCBASE_NAME");
} catch (DfException e) {
--------------------------code ----------------------------------

the above piece of code works fine i am able to get teh session s_Query in the 2nd class

myquery =SessionState.getAttribute("newTest").toString();


But the prblem is when i set a Enumeration variable in the session it gives me an error "Object in session is not serializable"

------------------- my code ---------------------------
IDfEnumeration enumDispAttr = getSearchInfo().getSmartListDefinition().getDisplayAttributes();



now in my other class i access as follow

IDfEnumeration enumDispAttr3 = (IDfEnumeration)SessionState.getAttribute("col");
System.out.println("this is before1 session" );
try {


String strAttr3 = (String) enumDispAttr3.nextElement();
System.out.println("The value of enumstring in the excell class is :"+ strAttr3);

catch (Exception e)
System.out.println("the mistake here is" + e );

can you guys tell me how to pass Enumeration in session variables
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

An Enumeration is a 'cursor' type, and if they are now serializable then they're not serializable. You can either pass the parent object (if available) or iterate through the Enumeration, move each element to another data type, and then store that instead.
I agree. Here's the link:
subject: error while setting the session for Enumeration
jQuery in Action, 3rd edition