struts怎么从一个框架集(frameSet)跳转到一个单一页面?(就象smth.org)

enterprise 2005-08-01 02:25:51
想要用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?
...全文
652 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
hcom 2005-08-07
  • 打赏
  • 举报
回复
up
gxy19830818 2005-08-07
  • 打赏
  • 举报
回复
markup一下
den_dyj 2005-08-06
  • 打赏
  • 举报
回复
你可以写个全局的跳转页面login.jsp,在你的jsp中写个跳转方法用来清空session.在logout时调用清空方法.转向login.jsp.
enterprise 2005-08-05
  • 打赏
  • 举报
回复
已经找到办法了,在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>
enterprise 2005-08-02
  • 打赏
  • 举报
回复
不用struts,怎么实现,这个我知道。
但是现在需要用struts来实现,就象login一样,用一些Action,Form.
在LoginAction里跳转到第2个jsp.
但不知道怎么从第2个页面跳转到第一个页面。
mxlmwl 2005-08-02
  • 打赏
  • 举报
回复
和是否用structs无关,只要在jsp中写js脚本就可以了。方法就是楼上所说的。
usherlight 2005-08-01
  • 打赏
  • 举报
回复
放一个按钮,调用JavaScript的函数。
function f(){
parent.location.href="login.jsp";
document.forms[0].submit();
}
也就是先把父窗口的定向到Login.jsp;
然后再提交Form,执行Action

67,550

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧