Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

response.sendRedirect not working when Parent window is closed

 
Sajee Joseph
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
 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the window is closed the request itself would close and thus response doen't have a destination.

You can think of progress window in between which itself will close when the servlet thread completes the timeconsuming process.

Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic