944,134 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Marked Solved
  • Views: 5839
  • JSP RSS
Oct 30th, 2009
0

response.sendRedirect()

Expand Post »
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:

JSP Syntax (Toggle Plain Text)
  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.
Reputation Points: 7
Solved Threads: 1
Posting Whiz in Training
AshtonHogan is offline Offline
209 posts
since Jul 2009
Oct 30th, 2009
0
Re: response.sendRedirect()
use a servlet to perform your check and then add a target attribute to the request object and forward it to the JSP
Reputation Points: 14
Solved Threads: 12
Junior Poster
ejosiah is offline Offline
119 posts
since Feb 2008
Oct 31st, 2009
0
Re: response.sendRedirect()
Hi,

I found an easy script to do this:

JSP Syntax (Toggle Plain Text)
  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:

JSP Syntax (Toggle Plain Text)
  1. <body onload="javascript:breakout();">

Thanks,
-Ashton.
Reputation Points: 7
Solved Threads: 1
Posting Whiz in Training
AshtonHogan is offline Offline
209 posts
since Jul 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: help me with the following JSP code
Next Thread in JSP Forum Timeline: how can i run jsp





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC