This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes response.sendRedirect not working when Parent window is closed - Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Servlets
Bookmark "response.sendRedirect not working when Parent window is closed - Help" Watch "response.sendRedirect not working when Parent window is closed - Help" New topic

response.sendRedirect not working when Parent window is closed - Help

Sajee Joseph
Ranch Hand

Joined: Jan 17, 2001
Posts: 200
Hello all,

I have a jsp ( A.jsp). On click of a button 'Save' i invoke a servlet (ServletA) to get some operation done. after the operation is done i invoke 'B.jsp' using response.sendRedirect("/gem/B.jsp");
This works fine.
Actually the operation done ServletA is very time consuming. Thus as long as the user doesnt close 'A.jsp' browser window while the ServletA is executing, it work fine.
But if the user close the 'A.jsp' window, everything works fine except that the 'B.jsp' is not shown ie. response.sendRedirect("/gem/B.jsp") doent work anymore. How do i ensure that 'B.jsp' is shown even if 'A.jsp' browser window is closed.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Duplicate of:

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Pavel Cherkashin
Ranch Hand

Joined: Mar 04, 2005
Posts: 47
How do you imagine it should work?
The new window should be opened?

As Far as I Understand:
You push Save-button and send request to ServletA.
ServletA does some job and send request back.

The problem is when you close the window you loose the response.
In other words while window of browser is opened you can send
request and receive the responce. But you can not receive response
after window is closed. The server will produce it for you, but you will
not see it. New window will not be opened for you.

Pavel Cherkashin - <br />SCJP, SCWCD, SCDJWS, SCBCD, SCEA, ...<br />
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Pavlo is right. There's nowhere for the response to be shown so it's never shown at all.
In fact, the redirect is never executed at all because there's nothing to execute the redirect!

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: response.sendRedirect not working when Parent window is closed - Help
It's not a secret anymore!