Meaningless Drivel is fun!
The moose likes Servlets and the fly likes Javascript to reach inside a servlet... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Javascript to reach inside a servlet..." Watch "Javascript to reach inside a servlet..." New topic

Javascript to reach inside a servlet...

Aris Petridis

Joined: Jul 12, 2001
Posts: 5
Hi all, I hope this question is not very much off topic... I have a button on my main page which is used for logging out (for time being all it does is confirm and close the browser..). What I would like to do is somehow through that function, access a static Vector of all logged in users I am keeping in a servlet, and remove that user... Two things I don't know here... How can I (can I???) grab the user's id from a cookie that is stored previously by a servlet onto the browser of the user, and secondly, how to remove an entry with that name from the Vector...
I know this can most probably not be done simply through the javascript, so I know I might have to submit a form and call a servlet to do the job... but I don't want to have a different page saying goodbye and all that... If you got any ideas how this can be done as quickly (and easily) as possible pls drop me a few lines... Thank you,
Manohar Karamballi
Ranch Hand

Joined: Jul 17, 2001
Posts: 227
U can maintain vactor of users in Servlet context(Add to vector whenever he logs in) and can delete when he logs out...
I think by this way u can handle logout tracking...
Aris Petridis

Joined: Jul 12, 2001
Posts: 5
Yes, but how do I do this thru a javascript function inside a jsp??
Thomas Mcfarrow
Ranch Hand

Joined: Jul 09, 2001
Posts: 137
Have the javascript do a submit
I agree. Here's the link:
subject: Javascript to reach inside a servlet...
It's not a secret anymore!