• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic