Hi Monte,
You should cast the SessionAttribute:
String sessionUserId = (String)session.getAttribute("id")
Hope this helps.
-----Urspr�ngliche Nachricht-----
Von: A mailing list about Java Server Pages specification and reference
[mailto:JSP-INTEREST@;JAVA.SUN.COM] Im Auftrag von Monte Gardner
Gesendet: Mittwoch, 30. Oktober 2002 15:14
An: [EMAIL PROTECTED]
Betreff: session nonpersistence
I have a series of JSP pages that begin with a standard userid/password
login. The page that receives the login request (shop.jsp) stores the
id in the session like this
session.setAttribute("id",id);
when I print out
session.getAttribute("id");
on the same page, it prints the id of the user. However, once the user
goes to the next page where he views products, and I try to print out
the user id with
session.getAttribute("id") or
request.getSession().getAttribute("id")
It prints out null. I have a previous project on the same server in
which I did about the same thing, and it seems to work fine so I can't
see what I'm doing different between the two. What can cause the
session to forget stuff like this?
--Monte Glenn Gardner
========================================================================
===
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