Solved

Redirecting a page..

Posted on 2001-09-18
6
761 Views
Last Modified: 2007-12-19
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
Comment
Question by:epdass
  • 3
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
aryumin earned 25 total points
ID: 6490339
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
 
LVL 1

Expert Comment

by:praburamalingam
ID: 6492426
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
 
LVL 5

Expert Comment

by:aryumin
ID: 6492575
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:epdass
ID: 6492838
I like to accept the comment by aryumin
0
 

Author Comment

by:epdass
ID: 6492845
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
 
LVL 5

Expert Comment

by:aryumin
ID: 6493071
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java Jpanels and Jframe 8 33
Basic Java Case or If-Else statement... 3 51
MySqlDump not dumping triggers 1 31
hibernate example using maven 12 42
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question