• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 770
  • Last Modified:

Redirecting a page..

Hi everybody, I am using framesets which has got a TOP Frame and Bottom Frame. I have <form> in the bottom form. After submitting the Form, I am redirecting to a HTML page which I want to open in a main window (Parent / no framesets) and not in the bottom window and also not in a new page. How to proceed on with JSP. SUggestions or Piece of code is always welcome.
0
epdass
Asked:
epdass
  • 3
  • 2
1 Solution
 
aryuminCommented:
1. <form .... target="_top">

2. For Netscape browsers only:
response.addHeader("Window-target", "_top");

3. Use a client-side Javascript instead of redirect:
out.println("<script language=\"javascript\">");
out.println("top.location.href = \"page.htm\";");
out.println("</script>");
0
 
praburamalingamCommented:
1.Assume this to be your bottom frame.
2.Add this script
     <script language="JavaScript">
       function calme()
       {
     window.open("http://www.prabooo.com","_parent");
       }
     </script>
3.From the submit button call the script
  <form>
  <input type="button" onClick="calme()">
  </form>
4.this redirects to the url and opens in the whole window.
Hope this would hlp u.

0
 
aryuminCommented:
2praburamalingam: Is the piece of Javascript code better than <form ... target="_top">? :o)

PS. "Often, an Expert posts the solution to your problem as a comment because it is early in the collaboration process and other issues may be involved. In addition, it is common etiquette in some topics areas to always post comments and not answers."
(c) http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp#7
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
epdassAuthor Commented:
I like to accept the comment by aryumin
0
 
epdassAuthor Commented:
Hi

I find "<form target=_top>" itself enough for my work.

But I don't understand ur js

"-------------
2For Netscape browsers only:
response.addHeader("Window-target", "_top");

3. Use a client-side Javascript instead of redirect:
out.println("<script language=\"javascript\">");
out.println("top.location.href = \"page.htm\";");
out.println("</script>");
 "------------
Can I know the use of this code?

cheers
epdass
0
 
aryuminCommented:
The solution (2) will work with Netscape browsers only. You should send the additional HTTP header before redirect (in JSP, assume response is a com.caucho.server.http.Response, for example):
<%
response.addHeader("Window-target", "_top");
response.sendRedirect("http://www.server.com/some_page.jsp");
%>

The solution (3) is a _client-side_ javascript. Simply replace the
<%
response.sendRedirect("http://www.server.com/some_page.jsp");
%>
line with
<%
out.println("<script language=\"javascript\">");
out.println("top.location.href = \"http://www.server.com/some_page.jsp\";");
out.println("</script>");
%>
in your JSP page.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now