【发布时间】:2011-08-16 01:49:23
【问题描述】:
我在 IFRAME 中检索请求属性时遇到问题。 以下是sn-ps,在jsp1.jsp中,我有2个IFRAMES,其src是jsp2.jsp和jsp3.jsp。我想检索两个页面中的请求属性。基本上该属性是一个类的对象并且在 jsp1.jsp 页面中为类变量设置了一些值。我想在这 3 个页面之间共享该对象。在 IFRAME 中,我得到了属性的空值。我尝试了 session.setAttribute 和 request.setAttribute
jsp1.jsp
<td>
<%
Search beans=(Search)request.getAttribute("s");
session.setAttribute("s");
%>
<iframe name="frame1" id="frame1" tabIndex="-1" width="100%" height="100%"
frameborder="0" src="jsp2.jsp"></iframe>
<iframe name="frame2" id="frame2" tabIndex="-1" width="100%" height="100%"
frameborder="0" src="jsp3.jsp"></iframe>
</td>
jsp2.jsp
Search beans = (Search)session.getAttribute("s");
if (beans != null) {
//process the bean
}
有人可以告诉我如何检索设置的属性。而且我不能将它作为参数传递给 jsp2.jsp,因为它是一个对象
谢谢 普里亚姆
【问题讨论】:
标签: jsp iframe request session-variables