Solved

Servlet Question

Posted on 2006-07-17
2
208 Views
Last Modified: 2010-04-01
Here is the scenario. I try to make it undestandable as possible. This is a 100% servlet quesiton

1.I have a login screen. User logs in correct. Directs to another Servlet (Say UserInputData Servlet).
2.In this (UserInputData) servlet I have a "log out" link. If I click in this link the system will pop out a
   another servlet (say EndMessage servlet). All it asks for is a confirmation. There are two buttons in
   it(in EndMessage Servlet). They are -  "Want to continue with work" and  "Want to Quit". If the user
   clicks on "Want to Quit" it re-directs to the login screen.

   in the doPost() of EndMessage , I invalidate all session data.

3. So now the user is in the Log-In screen.

4. But On the address bar of the browser if I drop down the list, it has the history of Servlets loaded. For
   example the UserInputData servlet (Which was the one that went into after the login) is also there. So if
   I try to load it independently from selected from teh address bar list, it still loads with the old data.  I have
   coded that servlet (UserInputData) in such a way that if the user is not logged in,  to pop-up a "User Error"
   but although the user is logged out at this time, when I try to load the server (UserInputData) independently,
   from the browser's adress list it still loads. But IF I CLICK THE REFRESH BUTTON ON THE BROWSER, it pops
   the ERROR MESSAGE "User Error" I expect.

   So the question is, How come even if I loaded the servlet from the address history, it still loads the servlet with the
   invalidated information??? I was expecting to see popping the "User Error" because the user is logged out?

Please read this carefully. I tried best to explain the problem I have.
0
Comment
Question by:prain
2 Comments
 
LVL 17

Accepted Solution

by:
gops1 earned 100 total points
ID: 17124165
Expire your Cache:


<%
        // Set to expire far in the past.
        response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
        // Set standard HTTP/1.1 no-cache headers.
        response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
        // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
        response.addHeader("Cache-Control", "post-check=0, pre-check=0");
        // Set standard HTTP/1.0 no-cache header.
        response.setHeader("Pragma", "no-cache");
%>
0
 

Author Comment

by:prain
ID: 17124332
Bingo!. It works. Great Answer. You made my day!. Thank You!.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JTable - RowFilter & Columns Header. 3 140
Display the newly inserted values 3 74
Struts tiles for layout structure along with Angular JS. 4 152
instanceof  operator in java 26 87
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
Scenario: Your operations manager has discovered an anomaly in your security system. The business will start to suffer within 15 minutes if it is a major IT incident. What should she do? We have 6 recommendations for managing major incidents (https:…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now