Results 1 to 3 of 3
Thread: Help for logout and cookie
- 01-11-2011, 01:53 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 2
- Rep Power
- 0
Help for logout and cookie
Hi!:)
... I'm new to the forum and I hope to put this thread in the right section!
I have to make a simple web application that is able to handle the log-in
and log-off of a user, displaying a form of log-in if the user
not 'authenticated, the home page and if'.
Constraints of creation:
- Use cookies to maintain login information.
- Use other technologies ("Session" HTTP Java, for
example) for maintaining session information.
I created the application with eclipse / tomcat in Java
I made an index.html page, where I enter the login form
I created a servlet for login I check if user and pass are correct (with reference to a static database), displaying a homepage where the user is in database, if no error is present.
In this servlet HttpSession session and I used a counter to see how many times a user views the section ... so far so good ...
but how do I log out
I tried to put this code in homepage.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Home Page</title>
<body>
<h1> Benvenuto </h1><br><br>
<div>
<p>Operazioni disponibili</p>
<ul>
<li>Scrivi un commento</li>
<li>Cerca un articolo</li>
</ul>
</div>
<form action="ServletLogout" method="post">
<h3>Logout</h3>
</form>
</body>
and to build a servlet using session.invalidate logout ()
... .. but still keep the session open even if I log out ... HOW DO I ?!?!!?
And where / how to put COOKIE?!?!
I HOPE IN YOUR HELP ... THANKS
- 01-12-2011, 05:05 AM #2
Senior Member
- Join Date
- Mar 2009
- Location
- USA
- Posts
- 127
- Rep Power
- 0
- put logout on achor tag
- once log out is clicked ...redirect page to whateva u page u want to redirect.
- use session.invalidate() or response.getSession().invalidate()
- 01-12-2011, 06:59 AM #3
Member
- Join Date
- Jan 2011
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Creating cookie ?
By Char in forum NetworkingReplies: 8Last Post: 12-25-2010, 07:10 PM -
Setting domain of cookie
By mintyzzz in forum Java ServletReplies: 1Last Post: 10-23-2010, 04:29 AM -
Remove cookie
By erakhman in forum Java ServletReplies: 1Last Post: 08-09-2010, 11:16 AM -
Browser Cookie Access
By OrangeDog in forum Java AppletsReplies: 1Last Post: 04-28-2009, 04:44 AM -
Setting cookie from doPost
By Java Tip in forum Java TipReplies: 0Last Post: 01-25-2008, 07:08 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks