Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Redirect to different frame

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I wanted to redirect to a different frame when control is returned from the servlet to the jsp.How can this be done.
Thanks in advance
Sheen
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really a servlet question but you should use the HTML target attribute and set it to the name of the frame that you want to control.
 
Marshal
Posts: 67496
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Recommending a move to the HTML forum.
bear
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
parent.framename.location.href="blah"
 
Sheen Cool
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I not sure if i can use
parent.framename.location.href= ......
as this is in a servlet.
Usually i move back to the same frame by using.
redirectToURL(res,"name_of_file.jsp", uniqueId);
How can i use the target attribute in the servlet.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is what I am guessing they were actually talking about
<a href="<% blah %>" target="framename">Your link</a>
I will get others here to give you a better answer....
 
Bear Bibeault
Marshal
Posts: 67496
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

How can i use the target attribute in the servlet.


You can't. Once a request has been sent to a particular window (and that includes frames and iframes), the response must be sent back to that same window.
If you want the response to go into a different frame than its initiator, then you must use the target attribute on the client side to cause the request to be made into the desired window in the first place.
bear
[ October 10, 2003: Message edited by: Bear Bibeault ]
 
Sheen Cool
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok fine i am in the process of checking out the info that you send.(Calling the servlet from the other frame by defining the function there).i called the servlet from the other frame by putting the called function in the other frame but i am not able to call it as the jsp cant find the function.
This is what i did.
====================================================================
The main jsp
<% String RightTopPan = "ReportsTop.jsp?uniqueId="+uniqueId; %>
<% String RightBottomPan = "Reports.jsp?uniqueId="+uniqueId; %>

<HTML>
<HEAD><TITLE>Main</TITLE></HEAD>
<FRAMESET ROWS="50%,50%" border="0">
<frame name="RightTopFrame" src="<%=RightTopPan%>" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0" target="RightTopFrame" >
<frame name="RightBottomFrame" src="<%=EMCRightBottomPan%>" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0" target="RightBottomFrame">
</FRAMESET>
</HTML>
================================================================
The call to the servlet was from the ReportsTop.jsp but it should return from the servlet to Reports.jsp so i defined the function in Reports.jsp and called from ReportsTop.jsp as:
<table>
<tr>
<select size="1" name="D1" id = "report" name="report" onChange="top.RightBottomFrame.doGetid()">
<option ></option>
<option value="top20list" >Top 20 List</option>
</select>
</tr>
</table>
doGetid() function is in the Reports.jsp
top.RightBottomFrame.doGetid() doesnt seem to work.

Any suggestions...........
reply
    Bookmark Topic Watch Topic
  • New Topic