-
session ending (4 messages)
- Posted by: Vamsi Dantuluri
- Posted on: October 09 2000 20:27 EDT
I want to end the session and close the database connection .I am using session.invalidate method after this I want to redirect to a html page say first page.where can I handle this?Threaded Messages (4)
- session ending by Brad Bates on October 10 2000 10:09 EDT
- session ending by Brad Bates on October 10 2000 10:16 EDT
- session ending by Kari Sarsila on December 12 2000 04:04 EST
- session ending by Brad Bates on October 10 2000 10:16 EDT
- session ending by Brad Bates on October 10 2000 10:15 EDT
-
session ending[ Go to top ]
- Posted by: Brad Bates
- Posted on: October 10 2000 10:09 EDT
- in response to Vamsi Dantuluri
I used this in the body of a doGet or doPost:
// Payment received -- invalIdate the session
session.invalidate();
// set content type header before accessing the Writer
response.setContentType("text/html");
PrintWriter out = response.getWriter();
// then write the response
out.println("<html>" +
"<head><title> Receipt </title>" +
"<meta http-equiv=\"refresh\"
content=\"4; url=" +
"http://localhost/Fathom.html;\">" +
"</head>" +
"<body bgcolor=\"#FFFFFF\">" +
"<center>" +
"<hr> <br> " +
"<h1>" +
"<font size=\"+3\" color=\"red\">Fathom </font>" +
"<font size=\"+3\" color=\"black\">Communications</font>" +
"</h1>" +
"</center>" +
"<br> <hr> <br> ");
out.println("<h3>Thank you for purchasing your solution from us " +
request.getParameter("cardname") +
"<p>Please shop with us again soon!</h3>" +
"<p><i>This page automatically resets.</i>" +
"</body></html>");
out.close(); -
session ending[ Go to top ]
- Posted by: Brad Bates
- Posted on: October 10 2000 10:16 EDT
- in response to Brad Bates
Please ignore this one above, I don't know why this printed out.
-
session ending[ Go to top ]
- Posted by: Kari Sarsila
- Posted on: December 12 2000 04:04 EST
- in response to Brad Bates
.. or you could do that like
session.invalidate();
response.sendRedirect("page.html");
if you write a separate html-file you dont have to write all those "out.print();" -lines
-
session ending[ Go to top ]
- Posted by: Brad Bates
- Posted on: October 10 2000 10:15 EDT
- in response to Vamsi Dantuluri
I used this in the body of a doGet or doPost:
// Payment received -- invalIdate the session
session.invalidate();
// set content type header before accessing the Writer
response.setContentType("text/html");
PrintWriter out = response.getWriter();
// then write the response
out.println("<html>" +
"<head><title> Receipt </title>" +
"<meta http-equiv=\"refresh\"content=\"4; url=" +
"http://localhost/Fathom.html;\">" +
"</head>" +
"<body bgcolor=\"#FFFFFF\">" +
"<center>" +
"<hr> <br> " +
"<h1>" +
"<font size=\"+3\" color=\"red\">Fathom</font>" +
"<font size=\"+3\"
color=\"black\">Communications</font>" +
"</h1>" +
"</center>" +
"<br> <hr> <br> ");
out.println("<h3>Thank you for purchasing your
solution from us " +
request.getParameter("cardname") +
"<p>Please shop with us again soon!</h3>" +
"<p><i>This page automatically resets.</i>" +
"</body></html>");
out.close();
Then close out your database in the destroy method:
public void destroy() {
try{
connection.close();
}
catch (Exception e) {
System.out.println("Database close failed");
System.out.println(e.toString());
}
}