You must first take a new instance of the hashtable object and then assign to it the
value of the session variable....
that is:
Hashtable h = new Hashtable();
h = (Hashtable)session.getAttribute("mailMessages");
-----Original Message-----
From: Shahata, Ashraf [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 05, 2002 1:49 PM
To: [EMAIL PROTECTED]
Subject: HashMap
Hi all,
I've got the following code that uses the HashMap to pass to a session:
<%
HashMap messageList = new Hashtable();
messageList.put("company", "NetEffect");
messageList.put("company_address", "Oosteinde 1");
messageList.put("company_city", "Amsterdam");
session.setAttribute("mailMessages", messageList);
%>
However, everytime I retrieve it:
<%
Hashtable h = (Hashtable)session.getAttribute("mailMessages");
out.println(h);
%>
it comes back empty, i.e it fails!! I tried the same with HashTable and it
works fine with no problems!! Does anyone know if there is any restriction
with using HashMap in sessions?
Thanks
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com
==========================================================================To
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com