Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

clear session history and display the page again

Posted on 2004-11-14
8
Medium Priority
?
700 Views
Last Modified: 2008-02-01
I have a jsp page (out.jsp) wich contains a form with submit button. When "submit" is clicked, out.jsp calls a java servlet (controller.java) which then performs some operations and the results are again displayed by out.jsp. I track session history with HttpSession(inside controller.java) and display it each time "submit" button is pressed. In other words, I display all previous paramters the user selected. I need to create a "clear history" button. I guess I can try to use session.removeAttribute inside the servlet but I don't know how I would know which button was pressed (submit or clear?)

So, my question is in which file (out.jsp or controller.java) and how  I would create a function for clearing history, so that out.jsp is displayed again but without session history displayed.
0
Comment
Question by:na77
  • 2
  • 2
5 Comments
 
LVL 92

Accepted Solution

by:
objects earned 672 total points
ID: 12579597
set a value for your button, and check it in your servlet
or have the button call a different servlet
0
 
LVL 11

Assisted Solution

by:sompol_kiatkamolchai
sompol_kiatkamolchai earned 664 total points
ID: 12581893
Or you can have a hidden field name "action"

<input type="hidden" name="action">

and when you click submit or clear you have to set it value by javascript to "submit" or "clear"
and then in servlet use request.getParameter("action") and check whether it is submit or clear.
0
 
LVL 29

Assisted Solution

by:bloodredsun
bloodredsun earned 664 total points
ID: 12900346
Just make the clear button a link to the controller with the parameter clear as you aren't submitting any form info.

e.g.

controller.do?action=clear

Then in controller, check params and then if the sction is clear, call session.invalidate() to destroy session then create a new sesion with request.getSession(true) and forward back the the out.jsp page.
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13622505
I'm easy but I gave them the code required to kill the session so that's at least part of the solution...
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 13623699
I think I answered the question too.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Conducting a customer service survey used to be as straightforward as sending a template email out using checkboxes and numerical rating systems to measure satisfaction.
Welcome to 2018! Exciting things lie ahead in the world of tech. To start things off, we compiled great member articles on how to stay safe, ways to learn, and much more! Read on to start your new year right.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question