Frame 中使用Struts的问题

AlexGL 2006-04-14 09:55:03
我用了html中的Frame,然后使用了Struts,结果是我在Action中无法接收到相关信息,这是怎么回事??
...全文
157 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
AlexGL 2006-04-14
  • 打赏
  • 举报
回复
在EmployeeAction.java中,request.getAttribute方法不能接收到任何东西。。。用request.getParameter能接受到一些,但是我需要传递类阿。。。。。
AlexGL 2006-04-14
  • 打赏
  • 举报
回复
main.jsp
========================================
<%@ page contentType="text/html;charset=Cp943C" %>
<%@ page language="java" %>
<html>
<head>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<title>Employee</title>
</head>
<frameset framespacing="0" border="0" rows="80,100%" frameborder="0">
<frame name="top" scrolling="no" noresize target="main" src="top.jsp" marginwidth="0" marginheight="0">
<frameset cols="350,*">
<frame name="left" src="left.jsp" marginwidth="0" marginheight="0" scrolling="no" noresize></frame>
<frame name="main" src="employee.do?event=list" target="left" scrolling="auto" noresize marginwidth="0" marginheight="0">
</frame>
</frameset>
<noframes>
<body topmargin="0" leftmargin="0">

<p>hello</p>

</body>
</noframes>
</frameset>
</html>

====================================================

在top.jsp中我写的查询提交,然后,发送给employee.do,结果不能接收到数据。
:(

imA 2006-04-14
  • 打赏
  • 举报
回复
谁也不知道是怎么回事,什么描述都没有,


至少你应该把代码贴上来吧,然后说明你想达到的要求,现在出现的情况。
DemonLeo 2006-04-14
  • 打赏
  • 举报
回复
哦。。。听上去有些道理。。。但是我不是这样的,top.jsp中的target 所指的main不是main.jsp而是
<frame name="main" src="employee.do?event=list" target="left" scrolling="auto" noresize marginwidth="0" marginheight="0">
不过,感觉你的说的差不多是对的。。我回去再试试。。。
updn 2006-04-14
  • 打赏
  • 举报
回复
你在top中提交的是一个request,在frame的employee.do中是另外一个request了,看来你对jsp和servlet中的scope生存周期还没有完全明白。
对于你这个问题,只有用“imA(男的不会,会的不男)”的方法了。
imA 2006-04-14
  • 打赏
  • 举报
回复
果然是,你的top的target是main,然后再由main提交给employee.do,这个时候employee.do得到请求已经不是top给main的那个请求了。

解决的办法(不改变你当前框架)通过session传递,然后再后台employee.do得到属性后再在session中removeAttribute。只能这样。
imA 2006-04-14
  • 打赏
  • 举报
回复
你是说你在top.jsp中setAttribute了?然后提交给main?

那样你在后台是没有办法通过的request已经不是你在top中提交的那个request了,当然不能获得你在top中得到的东西了。

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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