I know this will is picky, but... QA is important.

>> s.putAttribute("User", u);

This line of code is incorrect!  There is no HttpSession.putAttribute()
method.  I believe that the responder was trying to refer to the
HttpSession.putValue() method which was deprecated as of version 2.2.  The
correct code is:

s.setAttribute("User", u);

>> User u = s.getAttribute("User");

This line of code will fail.  The HttpSession.getAttribute() method returns
a java.lang.Object reference.  Hence, you must explicitly cast the result to
the correct class.  This is correct:

User u = (User)s.getAttribute("User");

Not to be too picky, but this code is being kept for the "generations", so
to speak.  Better to have it correct, IMHO.

Bill Berger
Spherion

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to