File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Redirect browser location using servlets! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Redirect browser location using servlets!" Watch "Redirect browser location using servlets!" New topic

Redirect browser location using servlets!

A Sam

Joined: Aug 21, 2001
Posts: 13
When the session expires, I want the user to be send to login screen again.
But, if I use sendRedirect(target) from a frame in a browser, only that particular frame redirects to login screen.
How can I make the parent(browser) location move to the login screen by calling sendRedirect(target) from one of the frames?
Malhar Barai
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
u may continue using sendRedirect(target). but at the place where u put the link write the tag as:
< a href="../servlet/logout" target="_top">Logout
this would surely work.
good luck:-)

Malhar Barai
SOA & Java Book
A Sam

Joined: Aug 21, 2001
Posts: 13

I do not have a link to be clicked by the user.
As soon as the session expires,the servlet redirects to login screen.
But it happens only in that particular frame. What can be done in the servlet redirection to make the Url of the browser or parent frame point to login screen.
Rob Godfrey

Joined: Aug 23, 2001
Posts: 2
You could use javascript to redirect eg.
<script language="javascript">
I agree. Here's the link:
subject: Redirect browser location using servlets!
It's not a secret anymore!