473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Servlets + Jsp

157 100+
Hi all, I m a newbie and new to this site as well, I am working on a webapplication using Servlets,Jsp and JavaScript..the user logs into my application and after finishing his task he logs out,but even after logging out i.e(session.invalidate()) by saying back he can see the previous page when in turn he should be getting a 'you are logged out' or 'session expired message' ..can anyone help me with this ...Thanks in advance!
Dec 30 '06 #1
2 1513
Shanaj
51
Hi all, I m a newbie and new to this site as well, I am working on a webapplication using Servlets,Jsp and JavaScript..the user logs into my application and after finishing his task he logs out,but even after logging out i.e(session.invalidate()) by saying back he can see the previous page when in turn he should be getting a 'you are logged out' or 'session expired message' ..can anyone help me with this ...Thanks in advance!
hello,

just try this

<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
%>

<%
if(session.getAttribute("userId")==null)
{
res.sendRedirect("../error.html");
}
%>
Jan 2 '07 #2
abctech
157 100+
Hi Shanaj,

Thanx fr replyin, but actually i'd already used these headers in my page, still not working. I have designed my page using Front-page so I hd jst set these headers as Meta tags with the 'HTTP-EQUIV' attribute..and in my Jsp I'm just checking the session obj , as far the processing is concerned , all that is done in a Servlet,

The thing is that I've a webappln in wich a user after logging in fills up certain subscriptions and there is a 'logout' link on every page,on clicking it the user's session is invalidated saying session.invalidate() . Then on all the pages I just check if the session = null , if yes then the user should be redirected back to the home-page..but the thing is that on saying back the control doesn't even go into the scriptlet in order to chek this..it just directly displays the previous page ...and thus u cn see all the previous pages just by saying 'previous' and 'forward'. I' m still working on it and as a temp solution I've disabled the ''back' button thru JavaScript.
-------------------------------------------------------------------------------------------------------------------




hello,

just try this

<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
%>

<%
if(session.getAttribute("userId")==null)
{
res.sendRedirect("../error.html");
}
%>
Jan 4 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: N.K. | last post by:
Hi, I'm using Tomcat 7.2 and I'm trying to deploy an aplication that uses JSP and servlets. I'm actually trying to duplicate a production server but can't get it right. In the directory...
1
by: Sascha Pohlmann | last post by:
hello, I have the following problem: I would like to evacuate the logic from my jsp files in servlets. servlets provide database contents prepared in HTML tables, the jsp files are supposed...
3
by: Jose Munoz | last post by:
Hi all, I want to share some data for all my applications (servlets and jsps). For this i am using a JSP to set the variables with scope=application. When i get this data from some JSP all is o.k,...
0
by: Ruaan Kruger | last post by:
Hi there, I'm a junior java programmer that has just started working on j2ee. The company I worked for is currently using Struts for all new implementations etc. The problem is however that...
3
by: InterEC.NET | last post by:
Hello, Is there any C++ library or tool that is similar in functionality to what java servlets offer. We run an engineering job search website which is running on a home brewed java servlet...
3
by: Bit Byte | last post by:
I have written a custom servlet engine (and "wrapper" servlets) for some legacy code (C/C++) that I have. The servlets contain the bulk of my 1st 2 layers in a 3 tier architecture - i.e. data...
2
by: prakashsurya | last post by:
gud evening i need a help about servlets its a bit urgent actually the problem i am facing is when i use doGet method i am getting the result in servlets but when i am going for doPost i am...
0
by: ank99 | last post by:
hello...i m trying to run servlets(using GET) from wml page..... using apache tomcat 5.5 server and WinWap for Windows(version 3.2.1.28.)....its working fine as far as just to display wml form...
1
by: ank99 | last post by:
hello...i m trying to run servlets(using GET) from wml page..... web server : apache tomcat 5.5 server WAP Browser: WinWap for Windows(version 3.2.1.28.).... its working fine as far as just to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.