Java 如果有两条以上的记录,则在另一页中显示结果

Java 如果有两条以上的记录,则在另一页中显示结果,java,html,jsp,Java,Html,Jsp,我有一个小程序,它从服务器目录中读取文件路径,并将其显示为指向报表文件夹的链接,如report1.html Folder Structure ROOT>REPORTS>COMPANY_NAME>January>report1.html 在我的html页面中,它如下所示: Company Name -January( href to the report1.html) 呈现结果的HTML #foreach(${orgRepor

我有一个小程序,它从服务器目录中读取文件路径,并将其显示为指向报表文件夹的链接,如report1.html

      Folder Structure ROOT>REPORTS>COMPANY_NAME>January>report1.html
在我的html页面中,它如下所示:

     Company Name

         -January( href to the report1.html)
呈现结果的HTML

#foreach(${orgReport.reportGroupList}中的reportGroup)

${reportGroup.ReportGroupName}
#foreach(${reportGroup.reportList}中的报表)
#结束 #结束
如果有多个href链接,如何在另一个页面中显示。

您可以试试这个

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<c:forEach var="reportGroupList" items="${orgReport.reportGroupList}" varStatus="loop">
    <div onclick="window.open('Report${loop.index}.html', '_blank',
         top=500, left=500, width=400, height=400);">
             ${reportGroupList.ReportGroupName} Report${loop.index}
    </div>
</c:forEach>

${reportGroupList.ReportGroupName}报告${loop.index}
在各自的Report.html中,您可以填充指向报告路径的链接列表,如下所示

<c:forEach var="report" items="${sessionScope.reportList}">
    <tr><a href="${report.ReportPath}">${report.reportId}</a></tr>
</c:forEach>


如何将
标签的
href
设置为特定文件路径?你在使用任何JSTL表达式吗?是的,我刚才在上面添加了HTML。你的意思是,你想从其他页面或其他地方的这个表达式中获得
${report.ReportPath}
路径吗?你的网页和链接的结构如何?正确,例如,如果有多个href,它会使我的网页看起来凌乱。为了解决这个问题,如果href超过两个,我需要在单独的页面中显示href列表。如果用户在1月份单击,则需要用户使用href列表分隔页面。如果您在会话中添加了
reportList
,则您可以在任何地方访问它,对吗。您可以创建
div
,而不是在迭代
reportGroupList
时创建
links
,为每个
div
指定
id
,并在其上添加单击事件,该事件将调用html文件,就像
Report1.html、Report2.html等
。然后在相应的页面上填充
reportList
&创建
链接
中的可用数据。我没有对此进行测试,但您可以尝试类似的方法。非常有用,但页面没有呈现这是输出${reportGroup.ReportGroupName}Report${loop.index},但不是values@Lokesh这是输出${reportGroup.ReportGroupName}报告${loop.index},但不是值的意思?我没有得到确切的答案?你现在处于什么阶段?你得到第一个循环中的页面列表了吗?我认为第一个循环中var的名称有错误。它是
reportGroupList
&我写的
${reportGroup.ReportGroupName}
。它应该是
${reportGroupList.ReportGroupName}
。我已使用此更改更新了我的答案。让我们试试这个变化。
<c:forEach var="report" items="${sessionScope.reportList}">
    <tr><a href="${report.ReportPath}">${report.reportId}</a></tr>
</c:forEach>