Solved

Redirecting a page..

Posted on 2001-09-18
6
759 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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 one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now