response.sendRedirect()

Thread Solved

Join Date: Jul 2009
Posts: 93
Reputation: AshtonHogan is an unknown quantity at this point 
Solved Threads: 1
AshtonHogan AshtonHogan is offline Offline
Junior Poster in Training

response.sendRedirect()

 
0
  #1
Oct 30th, 2009
Hi,

I would like to know if it's possible to specify the "target='FrameName'" in response.sendRedirect("Home.jsp") by any chance?

I tried this:

  1. <!-- Security Check -->
  2. <form action="Login" target="_top">
  3. <%
  4. if ((String) request.getSession(false).getAttribute("sessionStatus") == null) {
  5. response.sendRedirect("Login?pageTimeout=yes");
  6. }
  7. %>
  8. </form>
  9. <!-- Security Check -->

But it doesn't work... The target remains the same.

Thanks,
-Ashton.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 114
Reputation: ejosiah is an unknown quantity at this point 
Solved Threads: 12
ejosiah's Avatar
ejosiah ejosiah is offline Offline
Junior Poster
 
0
  #2
Oct 30th, 2009
use a servlet to perform your check and then add a target attribute to the request object and forward it to the JSP
Knowledge is power but love conquers all
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 93
Reputation: AshtonHogan is an unknown quantity at this point 
Solved Threads: 1
AshtonHogan AshtonHogan is offline Offline
Junior Poster in Training
 
0
  #3
Oct 31st, 2009
Hi,

I found an easy script to do this:

  1. <script type="text/javascript">
  2. function breakout() {
  3.  
  4. <%
  5. if ((String) request.getSession(false).getAttribute("sessionStatus") == null) {
  6. %>
  7.  
  8. if (window.top != window.self) {
  9. window.top.location="Login"
  10. }
  11.  
  12. <%
  13. }
  14. %>
  15.  
  16. }
  17. </script>

Place that script in your <head></head> tags, then call it like this:

  1. <body onload="javascript:breakout();">

Thanks,
-Ashton.
Reply With Quote Quick reply to this message  
Reply

Tags
frames, jsp, redirect, response, sessions

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the JSP Forum


Views: 831 | Replies: 2
Thread Tools Search this Thread



Tag cloud for frames, jsp, redirect, response, sessions
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC