[英]How to redirect to main page with in frame from servlet?
I have 3 frames in screen , using frameset I did like this. 我在屏幕上有3帧,使用frameset我喜欢这样。
index.thml index.thml
<frameset rows="75%,25%">
<frameset cols="20%,80%">
<frame src="TreeGroup.jsp" name="left" id="f1"/>
<frame src="DisplayMap.jsp" name="top" id="f2"/>
</frameset>
<frame src="Tabs.jsp" name="bottom"/>
</frameset>
in frame f1
there is a link, if I click that , it opens VehicleReg
in frame f2
. 在帧
f1
有一个链接,如果我点击它,它VehicleReg
在帧f2
打开VehicleReg
。 In frame f2
I click submit, control goes to Servlet and servlet redirect to index.html. 在框架
f2
我单击提交,控制转到Servlet和servlet重定向到index.html。 Here is I am facing problem , 这是我面临的问题,
In Servlet I do as response.sendRedirect("index.html")
在Servlet中我做
response.sendRedirect("index.html")
but in Browser, It is already in index.html
, after servlet response in frame f2
it opens index.html
. 但是在浏览器中,它已经在
index.html
,在帧f2
servlet响应之后它打开了index.html
。 I mean it redirects index.html
with in frame f2
. 我的意思是它在框架
f2
重定向index.html
。 How to avoid this. 如何避免这种情况。 I want after servlet response a fresh
index.html
. 我想在servlet响应后获得一个新的
index.html
。 Can anyone help me in this please. 请有人帮我这个。
Add the following JavaScript code between the <head>
tags of your index.html
page. 在
index.html
页面的<head>
标记之间添加以下JavaScript代码。
<script type="text/javascript" language="JavaScript">
if (top.location != self.location) {
top.location.href = self.location.href;
}
</script>
This makes your index page automatically break out of the frames and reload itself. 这使您的索引页面自动脱离框架并重新加载自身。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.