原理是这样的:点击url,链接到框架(一次请求),框架中又配置了monitorForwardAction.do,它又会去做请求(这是第二次请求),所以一次请求之后,request里的东西会消失,所以monitorForwardAction里得不到从开始传入的属性,这时候,想要从开始点击传值的话,应设进session,但记得把值取过后将其remove
第二点要注意的,是类似于这样的情况:在一个类似于下面的框架网页中,点击上面frame的一个链接,产生一次请求,想要让其在下面的页面上显示,应该这么做:
下面的页面是上述框架页面operationList frame经过二次请求到达的页面,其中有这句:
<a href="
<c:out value="${bizFormViewURL}"/>
" target="infodetail">
<c:out value="${obj.reqId}" />
</a>
在其中指定了其显示的目标,就是框架页面下部的部分,这样,就用struts实现了点击上面,在下面显示的效果
-----------------------------------------------------------------------------------------------------------------------
<%@ page contentType="text/html;charset=utf-8"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html:html xhtml="true">
<head>
<title>申请单</title>
<html:base />
<style type="text/css">
<!--
BODY
{
font-size:12px;
font-family:Verdana;
border-top: 1px solid #000000; margin-top: 8px; margin-left: 5px; margin-right: 8px; scrollbar-face-color:#CCCCCC; scrollbar-shadow-color:#FFFFFF; scrollbar-highlight-color:#FFFFFF; scrollbar-3dlight-color:#6B7A92; scrollbar-darkshadow-color:#6B7A92; scrollbar-track-color:#E2E2E2; scrollbar-arrow-color:#6B7A92
filter: DropShadow(Color=skyblue, OffX=1, OffY=1, Positive=1);
}
.buttons { margin: 1px 2px 1px 2px; border-right: #5AA9FF 1px solid; border-top: #BFDEFF 1px solid; border-left: #BFDEFF 1px solid; border-bottom: #5AA9FF 1px solid; font-size: 12px; color: #003399; background: #EBF7FF; height: 15px;}
.DescriptionTd
{
color:#003399;
font-size:12px;
BACKGROUND-COLOR:#E1F5FF;
}
.ValueTd
{
BACKGROUND-COLOR:#E1F5FF;
font-size:12px;
}
.Value
{
width:95%;
font-size:12px;
}
.InnerTable
{
width:100%;
border-Collapse: collapse;
font-size:12px;
mm1:expression(this.border=0);
mm2:expression(this.cellPadding=0);
}
.OuterTable
{
width:100%;
border-Collapse: collapse;
mm1:expression(this.border=1);
mm2:expression(this.borderColor='white');
mm3:expression(this.cellPadding=2);
}
.SubjectDescTd
{
BORDER-RIGHT: thin groove;
BORDER-TOP: thin groove;
BORDER-LEFT: thin groove;
CURSOR: hand;
COLOR: White;
BORDER-BOTTOM: thin groove;
BACKGROUND-COLOR:#26A8FF;
font-size:12px;
TEXT-ALIGN: center;
font : bolder;
}
-->
</style>
</head>
<body>
<table>
<tr>
<td class="DescriptionTd" align="center">reqId</td>
<td class="DescriptionTd" align="center">createTime</td>
<td class="DescriptionTd" align="center">acceptMan</td>
<td class="DescriptionTd" align="center">reqNo</td>
<td class="DescriptionTd" align="center">status</td>
</tr>
<c:forEach items="${sessionScope.BusiRequestQueryReslutList}" var="obj">
<tr>
<td class="ValueTd" align="center">
<c:url var="bizFormViewURL" value="/acceptQueryAction.do">
<c:param name="reqId" value="${obj.reqId}" />
</c:url>
<a href="
<c:out value="${bizFormViewURL}"/>
" target="infodetail">
<c:out value="${obj.reqId}" />
</a>
</td>
<td class="ValueTd" align="center">
<fmt:formatDate value="${obj.createTime}" type="date" dateStyle="long"/>
</td>
<td class="ValueTd" align="center">
<c:out value="${obj.acceptMan}" />
</td>
<td class="ValueTd" align="center">
<c:url var="detailViewURL" value="/dsframe/viewDetail.jsp">
<c:param name="atomId" value="${obj.reqId}" />
</c:url>
<a href = "
<c:out value="${detailViewURL}" />
">
<c:out value="${obj.reqNo}" />
</td>
<td class="ValueTd" align="center">
<c:choose>
<c:when test="${obj.status == '0'}">
未完成
</c:when>
<c:when test="${obj.status == '1'}">
部分完成
</c:when>
<c:otherwise>
全部完成
</c:otherwise>
</c:choose>
</td>
</tr>
</c:forEach>
</table>
<c:remove scope="session" var="BusiRequestQueryReslutList"/>
<hr/>
</body>
</html:html>
-----------------------------------------------------------------------------------------------------------------------
框架页面:
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*" %>
<html>
<head>
<title>查看业务列表</title>
</head>
<frameset rows="30%,*" FRAMEBORDER="1" BORDER="1" resize="yes">
<frame name="operationList" src="<%=request.getContextPath()%>/monitorForwardAction.do" marginwidth="0" marginheight="0" >
<frame name="infodetail" src="<%=request.getContextPath()%>/dsframe/query/viewDetail.jsp" marginwidth="10" marginheight="0" >
<noframes>
<body>
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body>
</noframes>
</frameset>
</html>