在两个 jsp 中使用相同的 c:foreach

use the same c:foreach in two jsp

我有 2 jsp(正文,评论),在正文中 jsp 我写了一个出版物的代码,在评论中 我写了发布的评论,所以我在正文中开始 c:foreach 我想发送 P.publicationId 评论 JSp 。 我想知道我该怎么做谢谢

<c:foreach items="publication"  var="P"> 
<c:set var="tetst" value="${p.pucationId}" scope="request" />
        <input id="pubID_${loop.index}" type="hidden" value="${p.publicationId}">

    <c:set var="imgvid" value="IMAGE_VIDEO"/>
    <c:set var="statut" value="STATUT"/>
</c:foreach>

我用<c:set var="t" value="${p.publicationId}" scope="session">

到return发布id

解决方案是:

jsp1

<c:set var="test" value="${p}" scope="request" />

JSP2(获取变量)

<c:set var="p"  value="${requestScope.test}"/>