struts怎么从一个框架集(frameSet)跳转到一个单一页面?(就象smth.org)
想要用struts做一个类似水木清华bbs那样的东西,
第一页是login.jsp
在Action里return ActionForward("index.jsp"),跳转到第2页,
第二页是主页面index.jsp(是一个FrameSet)
左边是功能菜单meny.jsp,右边是显示的内容页面main.jsp
<!--index.jsp-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>欢迎莅临</title>
</head>
<frameset name=mainframe id=mainframe frameborder=0 border=0 cols="167,*">
<frame name=menu noresize marginwidth=0 marginheight=0 src="menu.jsp">
<frame name=main marginwidth=0 marginheight=0 src="main.jsp">
</frameset>
</html>
想要注销(logout)并跳转到第一页login.jsp(跳转后浏览器的后退按钮就应该不能用了,防止后退),不知道怎么做?
我是这么试的,但是只能跳转,没有办法注销。因为link没有什么触发相关事件。
在第2页的左边的menu.jsp里放了一个<html:link page="/login.jsp" target="_top">
代码为:
<html:html>
<head>
</head>
<body>
<html:form action="/logoutAction.do">
<table>
<tr>
<td>Hello,<bean:write name="loginForm" property="username"/></td>
<td><html:link page="/login.jsp" target="_top"><bean:message key="menu.logout.Title"/></html:link>
</td>
</tr>
</table>
</html:form>
另一种方法;放一个按钮,可以在Action里写注销事件,但是跳转时只能把左半边的menu.jsp跳转到login.jsp,右边的main.jsp还在,整个框架集还在。怎么才可以把整个FrameSet跳转到login.jsp?
问题点数:100、回复次数:7Top
1 楼usherlight(xingtian)回复于 2005-08-01 18:44:34 得分 0
放一个按钮,调用JavaScript的函数。
function f(){
parent.location.href="login.jsp";
document.forms[0].submit();
}
也就是先把父窗口的定向到Login.jsp;
然后再提交Form,执行ActionTop
2 楼mxlmwl(飞星)回复于 2005-08-02 13:05:24 得分 0
和是否用structs无关,只要在jsp中写js脚本就可以了。方法就是楼上所说的。Top
3 楼enterprise(enterprise)回复于 2005-08-02 15:38:56 得分 0
不用struts,怎么实现,这个我知道。
但是现在需要用struts来实现,就象login一样,用一些Action,Form.
在LoginAction里跳转到第2个jsp.
但不知道怎么从第2个页面跳转到第一个页面。Top
4 楼enterprise(enterprise)回复于 2005-08-05 19:50:13 得分 0
已经找到办法了,在Form里加一个参数target="_top"就转到单一界面上去了。
<html:html>
<head>
</head>
<body>
<html:form action="/logoutAction.do" target="_top">
<table>
<tr>
<td>Hello,<bean:write name="loginForm" property="username"/></td>
<td><html:link page="/login.jsp" target="_top"><bean:message key="menu.logout.Title"/></html:link>
</td>
</tr>
</table>
</html:form>Top
5 楼den_dyj()回复于 2005-08-06 15:53:44 得分 0
你可以写个全局的跳转页面login.jsp,在你的jsp中写个跳转方法用来清空session.在logout时调用清空方法.转向login.jsp.Top
6 楼gxy19830818(谈恋爱不如弹棉花)回复于 2005-08-07 14:30:07 得分 0
markup一下Top
7 楼hcom(迷失在爪哇世界中)回复于 2005-08-07 14:36:42 得分 0
upTop




