hi duke martin, the elves told me you had passed away but I didn't believe
them.

i use a database to do that, with the sessionid.  you can just use the session
but i prefer the database to keep track of who logged in and when.

so i have a table called UserSessions

username
timecreated
ip (so you can track em down :))
sessionid

use req.getSession(true).getId().toString() to get the session id.

so when they log in add the record to the database.  to get the current user
just query

select username from UserSessions where sessionid = '" + sessionid + "'" order
by timecreated (the loop through the resultset and use the last record to make
sure you get the latest log-in in case someone has logged in twice from the
same browser)

hope this helps!

dan
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Duke
> Martin
> Sent: Thursday, 1 July 1999 12:14
> To: [EMAIL PROTECTED]
> Subject: servlet-database question
>
>
> I am working on a servlet that interacts with a database.  The servlet
> requies the user to login and upon request displays the users account info.
> How do I keep track of &/or store who is currently logged in?  How can I
> pass the login info between servlets?
>
> Duke
>
> ___________________________________________________________________________
> 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
>

___________________________________________________________________________
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