wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
Author

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.

Regard's
Saj
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Duplicate of:
http://www.coderanch.com/t/286927/JSP/java/response-sendRedirect-not-working-when


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 />www.linkedin.com/in/pcherkas
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!


42
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: response.sendRedirect not working when Parent window is closed - Help
 
Similar Threads
how to redirect servlet to jsp on weblogic
response.sendRedirect not working when Parent window is closed
request.setAttribute() and request.getAttribute()
Parent window Refresh
Can't open a jsp in a pop up or iframe from another jsp in the same struts portlet